updating and renaming folders
This commit is contained in:
parent
417b22e36e
commit
b0086daea5
@ -10,8 +10,8 @@
|
||||
//======================================================
|
||||
// HARDWARE SETUP & SELECTION
|
||||
//======================================================
|
||||
// Arduino MEGA
|
||||
#ifdef ARDUINO_AVR_MEGA2560
|
||||
// Arduino Uno Or Nano Was The Hardware
|
||||
#ifdef ARDUINO_AVR_UNO || ARDUINO_AVR_NANO
|
||||
//------------------------------------------------------
|
||||
|
||||
// Library Nessesary
|
||||
@ -19,41 +19,7 @@
|
||||
#include <avr/power.h>
|
||||
#endif
|
||||
|
||||
// Serial Terminal
|
||||
#define Terminal Serial // SERIAL PORT USED AS TERMINAL WINDO FOR DEBUG
|
||||
#define isTerminal Terminal.available() // Terminal Serial Buffer Available
|
||||
#define flushTerminal while(isTerminal) { Terminal.read(); }
|
||||
|
||||
// Bluetooth Terminal
|
||||
#define Bluetooth Serial1 // We will Connect The HC-05 To Hardware Serial1 In Arduino Mega
|
||||
#define isBluetooth Bluetooth.available() // Bluetooth Serial Buffer Available
|
||||
#define flushBluetooth while(isBluetooth) { Bluetooth.read(); }
|
||||
|
||||
// JSON Object & Memory
|
||||
#define CAPACITY 100
|
||||
DynamicJsonDocument JSON(CAPACITY); // Building JSON Buffer
|
||||
|
||||
// LED Strip
|
||||
#define LED_STRIP 53 // LED STRIP PIN NUMBER
|
||||
#define NUM_PIXELS 14 // NUMBER OF LED'S IN NEO PIXEL STRIP
|
||||
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_PIXELS, LED_STRIP, NEO_GRB + NEO_KHZ800);
|
||||
|
||||
// Impact Detection
|
||||
#define VTH 14 // THRESHOLD VOLTAGE FOR ZERO POSITIONNING KICKING POWER SENSOR
|
||||
#define SENSOR_PIN A0 // IMPACT SENSOR
|
||||
#define RANDOM_SOURCE A7 // RANDOM NUMBER GENERATOR SOURCE
|
||||
|
||||
//------------------------------------------------------
|
||||
// Arduino Uno / Nano
|
||||
#elif ARDUINO_AVR_UNO || ARDUINO_AVR_NANO
|
||||
//------------------------------------------------------
|
||||
|
||||
// Library Nessesary
|
||||
#ifdef __AVR__
|
||||
#include <avr/power.h>
|
||||
#endif
|
||||
|
||||
/* ARDUINO NANO DOESNOT HAVE A SECOND NATIVE
|
||||
/* ARDUINO NANO DOESNOT HAVE A SECOND NATIVE
|
||||
SERIAL PORT SO WE USE SOFTWARE SERIAL LIBRARY */
|
||||
#include <SoftwareSerial.h>
|
||||
|
||||
@ -101,7 +67,7 @@
|
||||
* SPI PIN : CS 5, SCK 18, MISO 19, MOSI 23 (DIGITAL)
|
||||
* BOOST CONTROL PIN : 14 (DIGITAL) OUTPUT ON PADS (TP1 +5V, TP2 GND)
|
||||
* LED PIN : 13 (DIGITAL)
|
||||
* BATTERY MONITOR PIN : 35 (ANALOG)
|
||||
* BATTERY MONITOR PIN : 35 (ANALOG)
|
||||
*/
|
||||
|
||||
/* ESP32 HAVE A NATIVE BLUETOOTH MODULE
|
||||
@ -136,7 +102,7 @@
|
||||
#define VTH 14 // THRESHOLD VOLTAGE FOR ZERO POSITIONNING KICKING POWER SENSOR
|
||||
#define SENSOR_PIN 39 // IMPACT SENSOR
|
||||
#define RANDOM_SOURCE 34 // RANDOM NUMBER GENERATOR SOURCE
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Exclusive Features Of TAKEONE BOARD
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -144,7 +110,7 @@
|
||||
/* ESP32 TAKEONE Board has some unique hardware features
|
||||
* 1. Battery Voltage Level Monitoring Via Analog Pin 35
|
||||
* 2. Boost Converter In Case We Need 5V Supply From Li-Ion Battery
|
||||
* 3. I2C : Motion Sensor IMU/MPU9250 9 Degrees Of Fredom
|
||||
* 3. I2C : Motion Sensor IMU/MPU9250 9 Degrees Of Fredom
|
||||
* 4. SPI : SDCARD Reader */
|
||||
|
||||
// Boost Converter
|
||||
@ -205,7 +171,7 @@
|
||||
//======================================================
|
||||
|
||||
// READING THE IMPACT
|
||||
int readImpact()
|
||||
int readImpact()
|
||||
{
|
||||
int value = analogRead(SENSOR_PIN);
|
||||
return value;
|
||||
@ -215,7 +181,7 @@
|
||||
// MAIN HARDWARE SETUP
|
||||
//======================================================
|
||||
|
||||
void setup()
|
||||
void setup()
|
||||
{
|
||||
// Communications
|
||||
Terminal.begin(9600);
|
||||
@ -251,10 +217,10 @@
|
||||
// MAIN PROGRAM LOOP
|
||||
//======================================================
|
||||
|
||||
void loop()
|
||||
void loop()
|
||||
{
|
||||
// Reading From Bluetooth
|
||||
if(isBluetooth)
|
||||
if(isBluetooth)
|
||||
{
|
||||
// Reading Message From Bluetooth
|
||||
String msg = Bluetooth.readStringUntil('\n');
|
||||
@ -263,7 +229,7 @@
|
||||
|
||||
// Display On Serial Monitor For Debuging
|
||||
terminal(msg);
|
||||
|
||||
|
||||
// Deserialize the JSON document
|
||||
DeserializationError error = deserializeJson(JSON, msg);
|
||||
|
||||
@ -279,7 +245,7 @@
|
||||
|
||||
// Clearing JSON Buffer
|
||||
JSON.clear();
|
||||
|
||||
|
||||
// Entering To Game Selector
|
||||
game_selector(game, settings);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user