updating and renaming folders

This commit is contained in:
Ghassan Yusuf 2020-05-22 09:38:28 +03:00
parent 417b22e36e
commit b0086daea5

View File

@ -10,8 +10,8 @@
//====================================================== //======================================================
// HARDWARE SETUP & SELECTION // HARDWARE SETUP & SELECTION
//====================================================== //======================================================
// Arduino MEGA // Arduino Uno Or Nano Was The Hardware
#ifdef ARDUINO_AVR_MEGA2560 #ifdef ARDUINO_AVR_UNO || ARDUINO_AVR_NANO
//------------------------------------------------------ //------------------------------------------------------
// Library Nessesary // Library Nessesary
@ -19,41 +19,7 @@
#include <avr/power.h> #include <avr/power.h>
#endif #endif
// Serial Terminal /* ARDUINO NANO DOESNOT HAVE A SECOND NATIVE
#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
SERIAL PORT SO WE USE SOFTWARE SERIAL LIBRARY */ SERIAL PORT SO WE USE SOFTWARE SERIAL LIBRARY */
#include <SoftwareSerial.h> #include <SoftwareSerial.h>
@ -101,7 +67,7 @@
* SPI PIN : CS 5, SCK 18, MISO 19, MOSI 23 (DIGITAL) * SPI PIN : CS 5, SCK 18, MISO 19, MOSI 23 (DIGITAL)
* BOOST CONTROL PIN : 14 (DIGITAL) OUTPUT ON PADS (TP1 +5V, TP2 GND) * BOOST CONTROL PIN : 14 (DIGITAL) OUTPUT ON PADS (TP1 +5V, TP2 GND)
* LED PIN : 13 (DIGITAL) * LED PIN : 13 (DIGITAL)
* BATTERY MONITOR PIN : 35 (ANALOG) * BATTERY MONITOR PIN : 35 (ANALOG)
*/ */
/* ESP32 HAVE A NATIVE BLUETOOTH MODULE /* ESP32 HAVE A NATIVE BLUETOOTH MODULE
@ -136,7 +102,7 @@
#define VTH 14 // THRESHOLD VOLTAGE FOR ZERO POSITIONNING KICKING POWER SENSOR #define VTH 14 // THRESHOLD VOLTAGE FOR ZERO POSITIONNING KICKING POWER SENSOR
#define SENSOR_PIN 39 // IMPACT SENSOR #define SENSOR_PIN 39 // IMPACT SENSOR
#define RANDOM_SOURCE 34 // RANDOM NUMBER GENERATOR SOURCE #define RANDOM_SOURCE 34 // RANDOM NUMBER GENERATOR SOURCE
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Exclusive Features Of TAKEONE BOARD // Exclusive Features Of TAKEONE BOARD
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -144,7 +110,7 @@
/* ESP32 TAKEONE Board has some unique hardware features /* ESP32 TAKEONE Board has some unique hardware features
* 1. Battery Voltage Level Monitoring Via Analog Pin 35 * 1. Battery Voltage Level Monitoring Via Analog Pin 35
* 2. Boost Converter In Case We Need 5V Supply From Li-Ion Battery * 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 */ * 4. SPI : SDCARD Reader */
// Boost Converter // Boost Converter
@ -205,7 +171,7 @@
//====================================================== //======================================================
// READING THE IMPACT // READING THE IMPACT
int readImpact() int readImpact()
{ {
int value = analogRead(SENSOR_PIN); int value = analogRead(SENSOR_PIN);
return value; return value;
@ -215,7 +181,7 @@
// MAIN HARDWARE SETUP // MAIN HARDWARE SETUP
//====================================================== //======================================================
void setup() void setup()
{ {
// Communications // Communications
Terminal.begin(9600); Terminal.begin(9600);
@ -251,10 +217,10 @@
// MAIN PROGRAM LOOP // MAIN PROGRAM LOOP
//====================================================== //======================================================
void loop() void loop()
{ {
// Reading From Bluetooth // Reading From Bluetooth
if(isBluetooth) if(isBluetooth)
{ {
// Reading Message From Bluetooth // Reading Message From Bluetooth
String msg = Bluetooth.readStringUntil('\n'); String msg = Bluetooth.readStringUntil('\n');
@ -263,7 +229,7 @@
// Display On Serial Monitor For Debuging // Display On Serial Monitor For Debuging
terminal(msg); terminal(msg);
// Deserialize the JSON document // Deserialize the JSON document
DeserializationError error = deserializeJson(JSON, msg); DeserializationError error = deserializeJson(JSON, msg);
@ -279,7 +245,7 @@
// Clearing JSON Buffer // Clearing JSON Buffer
JSON.clear(); JSON.clear();
// Entering To Game Selector // Entering To Game Selector
game_selector(game, settings); game_selector(game, settings);
} }