Programming ESP32
Project #26 – Radio Frequency – 4×4 Offroad Race – Mk15
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #Games #Gamepad #ESP32 #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
4×4 Offroad Race
3D off-road racing game. Powerful off-road vehicles, trails and routes running on dirt roads, extreme weather conditions and violent opponents, all that we call 4×4 Offroad Race. You will be able to experience the most powerful four-wheel drive vehicles. You have to overcome terrible roads, do jumps over bumps and potholes and knock opponents off the track to win all the races.
DL2304Mk03
1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Joystick Shield Kit
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 1 Ah
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LJH – Analog A3
LJV – Analog A2
LJS – Digital 12
RJH – Analog A1
RJV – Analog A0
RJS – Digital 21
LD1 – Digital 16
LD2 – Digital 18
LD3 – Digital 19
LD4 – Digital 17
LT – Digital 5
LED – LED_BUILTIN
VIN – +3.3V
GND – GND
——
DL2304Mk03p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - 4x4 Offroad Race - Mk15 26-15 DL2304Mk03p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x SparkFun Joystick Shield Kit 1 x Thumb Joystick 1 x SparkFun Thumb Joystick Breakout 1 x Terminal Block Breakout FeatherWing 1 x Lithium Ion Battery - 1 Ah 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Arduino #include <Arduino.h> // ESP32 BLE Gamepad #include <BleGamepad.h> // ESP32 BLE Gamepad BleGamepad bleGamepad; // Left Joystick #define LJH A3 #define LJV A2 #define LJS 12 // Right Joystick #define RJH A0 #define RJV A1 #define RJS 21 // D-pad #define LD1 19 #define LD2 17 #define LD3 18 #define LD4 16 // LT #define LT 5 // Previous Button State int previousButton1State = HIGH; int previousButton2State = HIGH; int previousButton3State = HIGH; int previousButton4State = HIGH; int previousButton5State = HIGH; int previousButton6State = HIGH; int previousButton7State = HIGH; // Number of pot samples to take (to smooth the values) const int numberOfPotSamples = 5; // Delay in milliseconds between pot samples const int delayBetweenSamples = 2; // Additional delay in milliseconds between HID reports const int delayBetweenHIDReports = 5; // Delay in milliseconds between button press const int debounceDelay = 10; // Software Version Information String sver = "26-15"; void loop() { // Bluetooth Serial (ESP32SPP) isBluetooth(); }
getBluetooth.ino
// Bluetooth // isBluetooth void isBluetooth() { // ESP32 BLE Gamepad if(bleGamepad.isConnected()) { // Button isButton(); // Joystick isThumbJoystick(); } }
getGames.ino
// Games // Set Inputs void setInputs() { // Make the button line an input pinMode(LJS, INPUT_PULLUP); pinMode(RJS, INPUT_PULLUP); pinMode(LD1, INPUT_PULLUP); pinMode(LD2, INPUT_PULLUP); pinMode(LD3, INPUT_PULLUP); pinMode(LD4, INPUT_PULLUP); pinMode(LT, INPUT_PULLUP); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); } // Button void isButton(){ // Button1 State LD1 int currentButton1State = digitalRead(LD1); if (currentButton1State != previousButton1State) { if (currentButton1State == LOW) { bleGamepad.press(BUTTON_1); } else { bleGamepad.release(BUTTON_1); } } previousButton1State = currentButton1State; // Button2 State LD2 int currentButton2State = digitalRead(LD2); if (currentButton2State != previousButton2State) { if (currentButton2State == LOW) { bleGamepad.press(BUTTON_2); } else { bleGamepad.release(BUTTON_2); } } previousButton2State = currentButton2State; // Button3 State LD3 int currentButton3State = digitalRead(LD3); if (currentButton3State != previousButton3State) { if (currentButton3State == LOW) { bleGamepad.press(BUTTON_3); } else { bleGamepad.release(BUTTON_3); } } previousButton3State = currentButton3State; // Button4 State LD4 int currentButton4State = digitalRead(LD4); if (currentButton4State != previousButton4State) { if (currentButton4State == LOW) { bleGamepad.press(BUTTON_4); } else { bleGamepad.release(BUTTON_4); } } previousButton4State = currentButton4State; // Button5 State LJS int currentButton5State = digitalRead(LJS); if (currentButton5State != previousButton5State) { if (currentButton5State == LOW) { bleGamepad.press(BUTTON_5); } else { bleGamepad.release(BUTTON_5); } } previousButton5State = currentButton5State; // Button6 State RJS int currentButton6State = digitalRead(RJS); if (currentButton6State != previousButton6State) { if (currentButton6State == LOW) { bleGamepad.press(BUTTON_6); } else { bleGamepad.release(BUTTON_6); } } previousButton6State = currentButton6State; // Button7 State LT int currentButton7State = digitalRead(LT); if (currentButton7State != previousButton7State) { if (currentButton7State == LOW) { bleGamepad.press(BUTTON_7); } else { bleGamepad.release(BUTTON_7); } } previousButton7State = currentButton7State; }
getThumbJoystick.ino
// Thumb Joystick void isThumbJoystick() { // Joystick LJH // Joystick Pot Values LJH int potValues[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues[i] = analogRead(LJH); delay(delayBetweenSamples); } int potValue = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue += potValues[i]; } // Value / Pot Samples potValue = potValue / numberOfPotSamples; // Adjusted Value int adjustedValue = map(potValue, 0, 4095, 32737, 0); // Joystick LJV // Joystick Pot Values LJV int potValues2[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues2[i] = analogRead(LJV); delay(delayBetweenSamples); } int potValue2 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue2 += potValues2[i]; } // Value2 / Pot Samples potValue2 = potValue2 / numberOfPotSamples; // Adjusted Value2 int adjustedValue2 = map(potValue2, 0, 4095, 32737, 0); // Joystick RJH // Joystick Pot Values RJH int potValues3[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues3[i] = analogRead(RJH); delay(delayBetweenSamples); } int potValue3 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue3 += potValues3[i]; } // Value3 / Pot Samples potValue3 = potValue3 / numberOfPotSamples; // Adjusted Value3 int adjustedValue3 = map(potValue3, 0, 4095, 32737, 0); // Joystick RJV // Joystick Pot Values RJV int potValues4[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues4[i] = analogRead(RJV); delay(delayBetweenSamples); } int potValue4 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue4 += potValues4[i]; } // Value4 / Pot Samples potValue4 = potValue4 / numberOfPotSamples; // Adjusted Value4 int adjustedValue4 = map(potValue4, 0, 4095, 0, 32737); //bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_CENTERED); bleGamepad.setAxes(adjustedValue, adjustedValue2, adjustedValue4, 0, adjustedValue3, 0, DPAD_CENTERED); delay(delayBetweenHIDReports); // D-pad // LD1 if (digitalRead(LD1) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, adjustedValue4, 0, adjustedValue3, 0, DPAD_UP); } // LD2 if (digitalRead(LD2) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, adjustedValue4, 0, adjustedValue3, 0, DPAD_LEFT); } // LD3 if (digitalRead(LD3) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, adjustedValue4, 0, adjustedValue3, 0, DPAD_DOWN); } // LD4 if (digitalRead(LD4) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, adjustedValue4, 0, adjustedValue3, 0, DPAD_RIGHT); } }
setup.ino
// Setup void setup() { // Set Inputs setInputs(); // ESP32 BLE Gamepad bleGamepad.begin(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – Gamepad Tester – Mk14
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #JoystickTest #Gamepad #ESP32 #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Controller & Gamepad Tester
You can begin testing your controller or gamepad by pressing a button or moving one of the analog sticks on your gamepad. When you press a button or move an analog stick, the illustration above should light up or display the movement of your analog stick. When we detect movement or button presses, the “Controller Detected” message will show up with your controller’s name in it. If you have multiple controllers or gamepads connected, then please try them one by one. Even though the illustration represents an Xbox controller, the test also works with other similar controllers.
DL2304Mk02
1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Joystick Shield Kit
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 1 Ah
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LJH – Analog A3
LJV – Analog A2
LJS – Digital 12
RJH – Analog A1
RJV – Analog A0
RJS – Digital 21
LD1 – Digital 16
LD2 – Digital 18
LD3 – Digital 19
LD4 – Digital 17
LT – Digital 5
LED – LED_BUILTIN
VIN – +3.3V
GND – GND
——
DL2304Mk02p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - - Mk14 26-14 DL2304Mk02p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x SparkFun Joystick Shield Kit 1 x Thumb Joystick 1 x SparkFun Thumb Joystick Breakout 1 x Terminal Block Breakout FeatherWing 1 x Lithium Ion Battery - 1 Ah 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Arduino #include <Arduino.h> // ESP32 BLE Gamepad #include <BleGamepad.h> // ESP32 BLE Gamepad BleGamepad bleGamepad; // Left Joystick #define LJH A3 #define LJV A2 #define LJS 12 // Right Joystick #define RJH A0 #define RJV A1 #define RJS 21 // D-pad #define LD1 19 #define LD2 17 #define LD3 18 #define LD4 16 // LT #define LT 5 // Previous Button State int previousButton1State = HIGH; int previousButton2State = HIGH; int previousButton3State = HIGH; int previousButton4State = HIGH; int previousButton5State = HIGH; int previousButton6State = HIGH; int previousButton7State = HIGH; // Number of pot samples to take (to smooth the values) const int numberOfPotSamples = 5; // Delay in milliseconds between pot samples const int delayBetweenSamples = 2; // Additional delay in milliseconds between HID reports const int delayBetweenHIDReports = 5; // Delay in milliseconds between button press const int debounceDelay = 10; // Software Version Information String sver = "26-14"; void loop() { // Bluetooth Serial (ESP32SPP) isBluetooth(); }
getBluetooth.ino
// Bluetooth // isBluetooth void isBluetooth() { // ESP32 BLE Gamepad if(bleGamepad.isConnected()) { // Button isButton(); // Joystick isThumbJoystick(); } }
getGames.ino
// Games // Set Inputs void setInputs() { // Make the button line an input pinMode(LJS, INPUT_PULLUP); pinMode(RJS, INPUT_PULLUP); pinMode(LD1, INPUT_PULLUP); pinMode(LD2, INPUT_PULLUP); pinMode(LD3, INPUT_PULLUP); pinMode(LD4, INPUT_PULLUP); pinMode(LT, INPUT_PULLUP); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); } // Button void isButton(){ // Button1 State LD1 int currentButton1State = digitalRead(LD1); if (currentButton1State != previousButton1State) { if (currentButton1State == LOW) { bleGamepad.press(BUTTON_1); } else { bleGamepad.release(BUTTON_1); } } previousButton1State = currentButton1State; // Button2 State LD2 int currentButton2State = digitalRead(LD2); if (currentButton2State != previousButton2State) { if (currentButton2State == LOW) { bleGamepad.press(BUTTON_2); } else { bleGamepad.release(BUTTON_2); } } previousButton2State = currentButton2State; // Button3 State LD3 int currentButton3State = digitalRead(LD3); if (currentButton3State != previousButton3State) { if (currentButton3State == LOW) { bleGamepad.press(BUTTON_3); } else { bleGamepad.release(BUTTON_3); } } previousButton3State = currentButton3State; // Button4 State LD4 int currentButton4State = digitalRead(LD4); if (currentButton4State != previousButton4State) { if (currentButton4State == LOW) { bleGamepad.press(BUTTON_4); } else { bleGamepad.release(BUTTON_4); } } previousButton4State = currentButton4State; // Button5 State LJS int currentButton5State = digitalRead(LJS); if (currentButton5State != previousButton5State) { if (currentButton5State == LOW) { bleGamepad.press(BUTTON_5); } else { bleGamepad.release(BUTTON_5); } } previousButton5State = currentButton5State; // Button6 State RJS int currentButton6State = digitalRead(RJS); if (currentButton6State != previousButton6State) { if (currentButton6State == LOW) { bleGamepad.press(BUTTON_6); } else { bleGamepad.release(BUTTON_6); } } previousButton6State = currentButton6State; // Button7 State LT int currentButton7State = digitalRead(LT); if (currentButton7State != previousButton7State) { if (currentButton7State == LOW) { bleGamepad.press(BUTTON_7); } else { bleGamepad.release(BUTTON_7); } } previousButton7State = currentButton7State; }
getThumbJoystick.ino
// Thumb Joystick void isThumbJoystick() { // Joystick LJH // Joystick Pot Values LJH int potValues[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues[i] = analogRead(LJH); delay(delayBetweenSamples); } int potValue = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue += potValues[i]; } // Value / Pot Samples potValue = potValue / numberOfPotSamples; // Adjusted Value int adjustedValue = map(potValue, 0, 4095, 32737, 0); // Joystick LJV // Joystick Pot Values LJV int potValues2[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues2[i] = analogRead(LJV); delay(delayBetweenSamples); } int potValue2 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue2 += potValues2[i]; } // Value2 / Pot Samples potValue2 = potValue2 / numberOfPotSamples; // Adjusted Value2 int adjustedValue2 = map(potValue2, 0, 4095, 32737, 0); // Joystick RJH // Joystick Pot Values RJH int potValues3[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues3[i] = analogRead(RJH); delay(delayBetweenSamples); } int potValue3 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue3 += potValues3[i]; } // Value3 / Pot Samples potValue3 = potValue3 / numberOfPotSamples; // Adjusted Value3 int adjustedValue3 = map(potValue3, 0, 4095, 32737, 0); Serial.print(" RJH: "); Serial.println(potValue3); // Joystick RJV // Joystick Pot Values RJV int potValues4[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues4[i] = analogRead(RJV); delay(delayBetweenSamples); } int potValue4 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue4 += potValues4[i]; } // Value4 / Pot Samples potValue4 = potValue4 / numberOfPotSamples; // Adjusted Value4 int adjustedValue4 = map(potValue4, 0, 4095, 0, 32737); Serial.print(" RJV: "); Serial.println(potValue4); //bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_CENTERED); bleGamepad.setAxes(adjustedValue, adjustedValue2, adjustedValue4, 0, adjustedValue3, 0, DPAD_CENTERED); delay(delayBetweenHIDReports); // D-pad // LD1 if (digitalRead(LD1) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, adjustedValue4, 0, adjustedValue3, 0, DPAD_UP); } // LD2 if (digitalRead(LD2) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, adjustedValue4, 0, adjustedValue3, 0, DPAD_LEFT); } // LD3 if (digitalRead(LD3) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, adjustedValue4, 0, adjustedValue3, 0, DPAD_DOWN); } // LD4 if (digitalRead(LD4) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, adjustedValue4, 0, adjustedValue3, 0, DPAD_RIGHT); } }
setup.ino
// Setup void setup() { // Serial Serial.begin(115200); // Set Inputs setInputs(); // ESP32 BLE Gamepad bleGamepad.begin(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – Joystick Test Application – Mk13
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #JoystickTest #Gamepad #ESP32 #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Joystick Test Application
While experimenting with making my own controllers recently, I needed a nice visual way of testing them in Windows. As you can see it’s pretty simple and just shows a visual representation of each axis, POV and button. Currently it supports Joysticks with 8 axes, 4 POV and up to 128 buttons. I haven’t had a chance to test it with over 32 buttons so I would be interested to here from anyone who has such a device. It should work on XP upwards but I have only tested it on Windows 10 64 bit. You just need Net framework 3 and DirectX 9 to run it.
DL2304Mk01
1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Joystick Shield Kit
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 1 Ah
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LJH – Analog A3
LJV – Analog A2
LJS – Digital 12
RJH – Analog A1
RJV – Analog A0
RJS – Digital 21
LD1 – Digital 16
LD2 – Digital 18
LD3 – Digital 19
LD4 – Digital 17
LT – Digital 5
LED – LED_BUILTIN
VIN – +3.3V
GND – GND
——
DL2304Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Joystick Test Application - Mk13 26-13 DL2304Mk01p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x SparkFun Joystick Shield Kit 1 x Thumb Joystick 1 x SparkFun Thumb Joystick Breakout 1 x Terminal Block Breakout FeatherWing 1 x Lithium Ion Battery - 1 Ah 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Arduino #include <Arduino.h> // ESP32 BLE Gamepad #include <BleGamepad.h> // ESP32 BLE Gamepad BleGamepad bleGamepad; // Left Joystick #define LJH A3 #define LJV A2 #define LJS 12 // Right Joystick #define RJH A1 #define RJV A0 #define RJS 21 // D-pad #define LD1 16 #define LD2 18 #define LD3 19 #define LD4 17 // LT #define LT 5 // Previous Button State int previousButton1State = HIGH; int previousButton2State = HIGH; int previousButton3State = HIGH; int previousButton4State = HIGH; int previousButton5State = HIGH; int previousButton6State = HIGH; int previousButton7State = HIGH; // Number of pot samples to take (to smooth the values) const int numberOfPotSamples = 5; // Delay in milliseconds between pot samples const int delayBetweenSamples = 2; // Additional delay in milliseconds between HID reports const int delayBetweenHIDReports = 5; // Delay in milliseconds between button press const int debounceDelay = 10; // Software Version Information String sver = "26-13"; void loop() { // Bluetooth Serial (ESP32SPP) isBluetooth(); }
getBluetooth.ino
// Bluetooth // isBluetooth void isBluetooth() { // ESP32 BLE Gamepad if(bleGamepad.isConnected()) { // Button isButton(); // Joystick isThumbJoystick(); } }
getGames.ino
// Games // Set Inputs void setInputs() { // Make the button line an input pinMode(LJS, INPUT_PULLUP); pinMode(RJS, INPUT_PULLUP); pinMode(LD1, INPUT_PULLUP); pinMode(LD2, INPUT_PULLUP); pinMode(LD3, INPUT_PULLUP); pinMode(LD4, INPUT_PULLUP); pinMode(LT, INPUT_PULLUP); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); } // Button void isButton(){ // Button1 State LD1 int currentButton1State = digitalRead(LD1); if (currentButton1State != previousButton1State) { if (currentButton1State == LOW) { bleGamepad.press(BUTTON_1); } else { bleGamepad.release(BUTTON_1); } } previousButton1State = currentButton1State; // Button2 State LD2 int currentButton2State = digitalRead(LD2); if (currentButton2State != previousButton2State) { if (currentButton2State == LOW) { bleGamepad.press(BUTTON_2); } else { bleGamepad.release(BUTTON_2); } } previousButton2State = currentButton2State; // Button3 State LD3 int currentButton3State = digitalRead(LD3); if (currentButton3State != previousButton3State) { if (currentButton3State == LOW) { bleGamepad.press(BUTTON_3); } else { bleGamepad.release(BUTTON_3); } } previousButton3State = currentButton3State; // Button4 State LD4 int currentButton4State = digitalRead(LD4); if (currentButton4State != previousButton4State) { if (currentButton4State == LOW) { bleGamepad.press(BUTTON_4); } else { bleGamepad.release(BUTTON_4); } } previousButton4State = currentButton4State; // Button5 State LJS int currentButton5State = digitalRead(LJS); if (currentButton5State != previousButton5State) { if (currentButton5State == LOW) { bleGamepad.press(BUTTON_5); } else { bleGamepad.release(BUTTON_5); } } previousButton5State = currentButton5State; // Button6 State RJS int currentButton6State = digitalRead(RJS); if (currentButton6State != previousButton6State) { if (currentButton6State == LOW) { bleGamepad.press(BUTTON_6); } else { bleGamepad.release(BUTTON_6); } } previousButton6State = currentButton6State; // Button7 State LT int currentButton7State = digitalRead(LT); if (currentButton7State != previousButton7State) { if (currentButton7State == LOW) { bleGamepad.press(BUTTON_7); } else { bleGamepad.release(BUTTON_7); } } previousButton7State = currentButton7State; }
getThumbJoystick.ino
// Thumb Joystick void isThumbJoystick() { // Joystick LJH // Joystick Pot Values LJH int potValues[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues[i] = analogRead(LJH); delay(delayBetweenSamples); } int potValue = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue += potValues[i]; } // Value / Pot Samples potValue = potValue / numberOfPotSamples; // Adjusted Value int adjustedValue = map(potValue, 0, 4095, 32737, 0); // Joystick LJV // Joystick Pot Values LJV int potValues2[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues2[i] = analogRead(LJV); delay(delayBetweenSamples); } int potValue2 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue2 += potValues2[i]; } // Value2 / Pot Samples potValue2 = potValue2 / numberOfPotSamples; // Adjusted Value2 int adjustedValue2 = map(potValue2, 0, 4095, 32737, 0); // Joystick RJH // Joystick Pot Values RJH int potValues3[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues3[i] = analogRead(RJH); delay(delayBetweenSamples); } int potValue3 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue3 += potValues3[i]; } // Value3 / Pot Samples potValue3 = potValue3 / numberOfPotSamples; // Adjusted Value3 int adjustedValue3 = map(potValue3, 0, 4095, 32737, 0); // Joystick RJV // Joystick Pot Values RJV int potValues4[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues4[i] = analogRead(RJV); delay(delayBetweenSamples); } int potValue4 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue4 += potValues4[i]; } // Value4 / Pot Samples potValue4 = potValue4 / numberOfPotSamples; // Adjusted Value4 int adjustedValue4 = map(potValue4, 0, 4095, 32737, 0); bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_CENTERED); delay(delayBetweenHIDReports); // D-pad // LD1 if (digitalRead(LD1) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_UP); } // LD2 if (digitalRead(LD2) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_LEFT); } // LD3 if (digitalRead(LD3) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_DOWN); } // LD4 if (digitalRead(LD4) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_RIGHT); } }
setup.ino
// Setup void setup() { // Set Inputs setInputs(); // ESP32 BLE Gamepad bleGamepad.begin(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – Gamepad – Mk12
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #Gamepad #SparkFunThingPlusESP32WROOM #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
Gamepad
A gamepad is a type of video game controller held in two hands, where the fingers are used to provide input. They are typically the main input device for video game consoles. Gamepads generally feature a set of buttons handled with the right thumb and a direction controller handled with the left. The direction controller has traditionally been a four-way digital cross, also named a joypad, or alternatively a D-pad, and never called arrow keys, but most modern controllers additionally feature one or more analog sticks.
DL2303Mk03
1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Joystick Shield Kit
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x Terminal Block Breakout FeatherWing
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LJH – Analog A3
LJV – Analog A2
LJS – Digital 12
RJH – Analog A1
RJV – Analog A0
RJS – Digital 21
LD1 – Digital 16
LD2 – Digital 18
LD3 – Digital 19
LD4 – Digital 17
LT – Digital 5
LED – LED_BUILTIN
VIN – +3.3V
GND – GND
——
DL2303Mk03p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Gamepad - Mk12 26-12 DL2303Mk03p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x SparkFun Joystick Shield Kit 1 x Thumb Joystick 1 x SparkFun Thumb Joystick Breakout 1 x Terminal Block Breakout FeatherWing 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Arduino #include <Arduino.h> // ESP32 BLE Gamepad #include <BleGamepad.h> // ESP32 BLE Gamepad BleGamepad bleGamepad; // Left Joystick #define LJH A3 #define LJV A2 #define LJS 12 // Right Joystick #define RJH A1 #define RJV A0 #define RJS 21 // D-pad #define LD1 16 #define LD2 18 #define LD3 19 #define LD4 17 // LT #define LT 5 // Number of pot samples to take (to smooth the values) const int numberOfPotSamples = 5; // Delay in milliseconds between pot samples const int delayBetweenSamples = 2; // Additional delay in milliseconds between HID reports const int delayBetweenHIDReports = 5; // Delay in milliseconds between button press const int debounceDelay = 10; // Software Version Information String sver = "26-12"; void loop() { // Bluetooth Serial (ESP32SPP) isBluetooth(); // Delay delay(500); }
getBluetooth.ino
// Bluetooth // isBluetooth void isBluetooth() { // ESP32 BLE Gamepad if(bleGamepad.isConnected()) { // Button isButton(); // Joystick isThumbJoystick(); // Serial Serial.println(" *"); } }
getGames.ino
// Games // Set Inputs void setInputs() { // Make the button line an input pinMode(LJS, INPUT_PULLUP); pinMode(RJS, INPUT_PULLUP); pinMode(LD1, INPUT_PULLUP); pinMode(LD2, INPUT_PULLUP); pinMode(LD3, INPUT_PULLUP); pinMode(LD4, INPUT_PULLUP); pinMode(LT, INPUT_PULLUP); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); } // Button void isButton(){ // Left Joystick if (digitalRead(LJS) == LOW) { bleGamepad.press(LJS); delay(debounceDelay); bleGamepad.release(LJS); Serial.print(" LJS"); } // Right Joystick if (digitalRead(RJS) == LOW) { bleGamepad.press(RJS); delay(debounceDelay); bleGamepad.release(RJS); Serial.print(" RJS"); } // LT if (digitalRead(LT) == LOW) { bleGamepad.press(LT); delay(debounceDelay); bleGamepad.release(LT); Serial.print(" LT"); } }
getThumbJoystick.ino
// Thumb Joystick void isThumbJoystick() { // Joystick LJH // Joystick Pot Values LJH int potValues[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues[i] = analogRead(LJH); delay(delayBetweenSamples); } int potValue = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue += potValues[i]; } // Value / Pot Samples potValue = potValue / numberOfPotSamples; // Serial Serial.print(" LJH: "); Serial.print(potValue); // Adjusted Value int adjustedValue = map(potValue, 0, 4095, 127, -127); // Joystick LJV // Joystick Pot Values LJV int potValues2[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues2[i] = analogRead(LJV); delay(delayBetweenSamples); } int potValue2 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue2 += potValues2[i]; } // Value2 / Pot Samples potValue2 = potValue2 / numberOfPotSamples; // Serial Serial.print(" LJV: "); Serial.print(potValue2); // Adjusted Value2 int adjustedValue2 = map(potValue2, 0, 4095, 127, -127); // Joystick RJH // Joystick Pot Values RJH int potValues3[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues3[i] = analogRead(RJH); delay(delayBetweenSamples); } int potValue3 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue3 += potValues3[i]; } // Value3 / Pot Samples potValue3 = potValue3 / numberOfPotSamples; // Serial Serial.print(" RJH: "); Serial.print(potValue3); // Adjusted Value3 int adjustedValue3 = map(potValue3, 0, 4095, 255, 0); // Joystick RJV // Joystick Pot Values RJV int potValues4[numberOfPotSamples]; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValues4[i] = analogRead(RJV); delay(delayBetweenSamples); } int potValue4 = 0; for (int i = 0 ; i < numberOfPotSamples ; i++) { potValue4 += potValues4[i]; } // Value4 / Pot Samples potValue4 = potValue4 / numberOfPotSamples; // Serial Serial.print(" RJV: "); Serial.print(potValue4); // Adjusted Value4 int adjustedValue4 = map(potValue4, 0, 4095, 255, 0); bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_CENTERED); delay(delayBetweenHIDReports); // D-pad // LD1 if (digitalRead(LD1) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_UP); Serial.print(" DPAD_UP"); } // LD2 if (digitalRead(LD2) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_LEFT); Serial.print(" DPAD_LEFT"); } // LD3 if (digitalRead(LD3) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_DOWN); Serial.print(" DPAD_DOWN"); } // LD4 if (digitalRead(LD4) == LOW){ bleGamepad.setAxes(adjustedValue, adjustedValue2, 0, 0, adjustedValue3, adjustedValue4, DPAD_RIGHT); Serial.print(" DPAD_RIGHT"); } }
setup.ino
// Setup void setup() { // Serial Serial.begin(115200); Serial.println("Starting BLE work!"); // Set Inputs setInputs(); // ESP32 BLE Gamepad bleGamepad.begin(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – Joystick – Mk11
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #Joystick #SparkFunJoystickShield #SparkFunThingPlusESP32WROOM #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Thumb Joystick
This is a joystick very similar to the “Analog” joysticks on PS2 controllers. Directional movements are simply two potentiometers, one for each axis. Pots are ~10k each. This joystick also has a select button that is actuated when the joystick is pressed down. This is the breakout board for the thumb joystick SparkFun Thumb Joystick Breakout.
DL2303Mk02
1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Joystick Shield Kit
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x Lithium Ion Battery – 1 Ah
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
DLE_UP – Digital 16
DLE_DOWN – Digital 19
DLE_LEFT – Digital 18
DLE_RIGHT – Digital 17
DLE_FIRE – Digital 12
DLE_SPACE – Digital 5
DLE_SPACEA – Digital 21
LED – LED_BUILTIN
VIN – +3.3V
GND – GND
——
DL2303Mk02p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Joystick - Mk11 26-11 DL2303Mk02p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x SparkFun Joystick Shield Kit 1 x Thumb Joystick 1 x SparkFun Thumb Joystick Breakout 1 x Lithium Ion Battery - 1 Ah 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // ESP32 BLE Keyboard - NIMBLE #define USE_NIMBLE #include <BleKeyboard.h> // ESP32 BLE Keyboard BleKeyboard bleKeyboard; // Game Controller Buttons #define DLE_UP 16 #define DLE_DOWN 19 #define DLE_LEFT 18 #define DLE_RIGHT 17 #define DLE_FIRE 12 #define DLE_SPACE 5 #define DLE_SPACEA 21 // Button bool keyStates[7] = {false, false, false, false, false, false, false}; int keyPins[7] = {DLE_UP, DLE_DOWN, DLE_LEFT, DLE_RIGHT, DLE_SPACEA, DLE_SPACE, DLE_FIRE}; uint8_t keyCodes[7] = {KEY_UP_ARROW, KEY_DOWN_ARROW, KEY_LEFT_ARROW, KEY_RIGHT_ARROW, ' ', ' ', KEY_LEFT_CTRL}; // Connect Notification Sent bool connectNotificationSent = false; // Software Version Information String sver = "26-11"; void loop() { // Bluetooth Serial (ESP32SPP) isBluetooth(); }
getBluetooth.ino
// Bluetooth // isBluetooth void isBluetooth() { // Counter int counter; // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Connect Notification Sent if (!connectNotificationSent) { connectNotificationSent = true; } // Button for(counter = 0; counter < 7; counter ++){ handleButton(counter); } } }
getGames.ino
// Games // Set Inputs void setInputs() { // Make the button line an input pinMode(DLE_UP, INPUT_PULLUP); pinMode(DLE_DOWN, INPUT_PULLUP); pinMode(DLE_LEFT, INPUT_PULLUP); pinMode(DLE_RIGHT, INPUT_PULLUP); pinMode(DLE_FIRE, INPUT_PULLUP); pinMode(DLE_SPACE, INPUT_PULLUP); pinMode(DLE_SPACEA, INPUT_PULLUP); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); } // Handle Button void handleButton(int keyIndex){ // Handle the button press if (!digitalRead(keyPins[keyIndex])){ // Button pressed if (!keyStates[keyIndex]){ // Key not currently pressed keyStates[keyIndex] = true; bleKeyboard.press(keyCodes[keyIndex]); } } else { // Button not pressed if (keyStates[keyIndex]){ // Key currently pressed keyStates[keyIndex] = false; bleKeyboard.release(keyCodes[keyIndex]); } } }
setup.ino
// Setup void setup() { // Set Inputs setInputs(); // ESP32 BLE Keyboard bleKeyboard.begin(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – Video Game – Mk10
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #SparkFunJoystickShield #SparkFunThingPlusESP32WROOM #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
LaunchBox
LaunchBox was originally built as an attractive frontend for DOSBox, but has long since expanded to support both modern PC games and emulated console platforms. LaunchBox aims to be the one-stop shop for gaming on your computer, for both modern and historical games.
LaunchBox includes automated import processes for everything from modern Steam games to GOG classics, ROM files, MS-DOS games, and so much more. Box art and metadata is automatically downloaded from the LaunchBox Games Database, with excellent coverage for your games.
Doom (Video Game MS-DOS)
Doom is a video game series and media franchise created by John Carmack, John Romero, Adrian Carmack, Kevin Cloud, and Tom Hall. The focuses on the exploits of an unnamed space marine operating under the auspices of the Union Aerospace Corporation, who fights hordes of demons and the undead in order to save Earth from an apocalyptic invasion.
The original Doom is considered one of the first pioneering first-person shooter games, introducing to IBM-compatible computers features such as 3D graphics, third-dimension spatiality, networked multiplayer gameplay, and support for player-created modifications with the Doom WAD format.
DL2303Mk01
1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Joystick Shield Kit
1 x Lithium Ion Battery – 1 Ah
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
DLE_UP – Digital 16
DLE_DOWN – Digital 19
DLE_LEFT – Digital 18
DLE_RIGHT – Digital 17
DLE_FIRE – Digital 21
DLE_SPACE – Digital 5
LED – LED_BUILTIN
VIN – +3.3V
GND – GND
——
DL2303Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Video Game - Mk10 26-10 DL2301Mk01p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x SparkFun Joystick Shield Kit 1 x Lithium Ion Battery - 1 Ah 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // ESP32 BLE Keyboard - NIMBLE #define USE_NIMBLE #include <BleKeyboard.h> // ESP32 BLE Keyboard BleKeyboard bleKeyboard; // Game Controller Buttons #define DLE_UP 16 #define DLE_DOWN 19 #define DLE_LEFT 18 #define DLE_RIGHT 17 #define DLE_FIRE 21 #define DLE_SPACE 5 // Button bool keyStates[6] = {false, false, false, false, false, false}; int keyPins[6] = {DLE_UP, DLE_DOWN, DLE_LEFT, DLE_RIGHT, DLE_FIRE, DLE_SPACE}; uint8_t keyCodes[6] = {KEY_UP_ARROW, KEY_DOWN_ARROW, KEY_LEFT_ARROW, KEY_RIGHT_ARROW, KEY_LEFT_CTRL, ' '}; // Connect Notification Sent bool connectNotificationSent = false; // Software Version Information String sver = "26-10"; void loop() { // Bluetooth Serial (ESP32SPP) isBluetooth(); }
getBluetooth.ino
// Bluetooth // isBluetooth void isBluetooth() { // Counter int counter; // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Connect Notification Sent if (!connectNotificationSent) { connectNotificationSent = true; } // Button for(counter = 0; counter < 6; counter ++){ handleButton(counter); } } }
getGames.ino
// Games // Set Inputs void setInputs() { // Make the button line an input pinMode(DLE_UP, INPUT_PULLUP); pinMode(DLE_DOWN, INPUT_PULLUP); pinMode(DLE_LEFT, INPUT_PULLUP); pinMode(DLE_RIGHT, INPUT_PULLUP); pinMode(DLE_FIRE, INPUT_PULLUP); pinMode(DLE_SPACE, INPUT_PULLUP); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); } // Handle Button void handleButton(int keyIndex){ // Handle the button press if (!digitalRead(keyPins[keyIndex])){ // Button pressed if (!keyStates[keyIndex]){ // Key not currently pressed keyStates[keyIndex] = true; bleKeyboard.press(keyCodes[keyIndex]); } } else { // Button not pressed if (keyStates[keyIndex]){ // Key currently pressed keyStates[keyIndex] = false; bleKeyboard.release(keyCodes[keyIndex]); } } }
setup.ino
// Setup void setup() { // Set Inputs setInputs(); // ESP32 BLE Keyboard bleKeyboard.begin(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – SparkFun Joystick Shield – Mk09
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #SparkFunJoystickShield #SparkFunThingPlusESP32WROOM #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun Joystick Shield Kit
The SparkFun Joystick Shield Kit contains all the parts you need to enable your Arduino with a joystick. The shield sits on top of your Arduino and turns it into a simple controller. Five momentary push buttons and a two-axis thumb joystick gives your Arduino functionality on the level of old Nintendo controllers. Soldering is required, but it’s relatively easy and requires minimal tools. We even have a step by step guide.
The momentary push buttons are connected to Arduino digital pins 2-6; when pressed they will pull the pin low. Vertical movement of the joystick will produce a proportional analog voltage on analog pin 0, likewise, horizontal movement of the joystick can be tracked on analog pin 1.
DL2302Mk04
1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Joystick Shield Kit
1 x Lithium Ion Battery – 1 Ah
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
DLE_UP – Digital 16
DLE_DOWN – Digital 19
DLE_LEFT – Digital 18
DLE_RIGHT – Digital 17
DLE_FIRE – Digital 21
DLE_SPACE – Digital 5
VIN – +3.3V
GND – GND
——
DL2302Mk04p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - SparkFun Joystick Shield - Mk09 26-09 DL2301Mk01p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x SparkFun Joystick Shield Kit 1 x Lithium Ion Battery - 1 Ah 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // ESP32 BLE Keyboard - NIMBLE #define USE_NIMBLE #include <BleKeyboard.h> // ESP32 BLE Keyboard BleKeyboard bleKeyboard; // Game Controller Buttons #define DLE_UP 16 #define DLE_DOWN 19 #define DLE_LEFT 18 #define DLE_RIGHT 17 #define DLE_FIRE 21 #define DLE_SPACE 5 // Button bool keyStates[6] = {false, false, false, false, false, false}; int keyPins[6] = {DLE_UP, DLE_DOWN, DLE_LEFT, DLE_RIGHT, DLE_FIRE, DLE_SPACE}; uint8_t keyCodes[6] = {'w', 'x', 'a', 'd', 'y', ' '}; // Connect Notification Sent bool connectNotificationSent = false; // Software Version Information String sver = "26-09"; void loop() { // Bluetooth Serial (ESP32SPP) isBluetooth(); }
getBluetooth.ino
// Bluetooth // isBluetooth void isBluetooth() { // Counter int counter; // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Connect Notification Sent if (!connectNotificationSent) { connectNotificationSent = true; } // Button for(counter = 0; counter < 6; counter ++){ handleButton(counter); } } }
getGames.ino
// Games // Set Inputs void setInputs() { // Make the button line an input pinMode(DLE_UP, INPUT_PULLUP); pinMode(DLE_DOWN, INPUT_PULLUP); pinMode(DLE_LEFT, INPUT_PULLUP); pinMode(DLE_RIGHT, INPUT_PULLUP); pinMode(DLE_FIRE, INPUT_PULLUP); pinMode(DLE_SPACE, INPUT_PULLUP); } // Handle Button void handleButton(int keyIndex){ // Handle the button press if (!digitalRead(keyPins[keyIndex])){ // Button pressed if (!keyStates[keyIndex]){ // Key not currently pressed keyStates[keyIndex] = true; bleKeyboard.press(keyCodes[keyIndex]); } } else { // Button not pressed if (keyStates[keyIndex]){ // Key currently pressed keyStates[keyIndex] = false; bleKeyboard.release(keyCodes[keyIndex]); } } }
setup.ino
// Setup void setup() { // Set Inputs setInputs(); // ESP32 BLE Keyboard bleKeyboard.begin(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #24 – RTOS – Bluetooth – Mk03
——
#DonLucElectronics #DonLuc #ESP32 #RTOS #FreeRTOS #Bluetooth #ThumbJoystick #Keyboard #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Joystick
A joystick is an input device consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. Joysticks are often used to control video games, and usually have one or more push-buttons whose state can also be read by the computer. A popular variation of the joystick used on modern video game consoles is the analog stick. Joysticks are also used for controlling machines such as cranes, trucks, underwater unmanned vehicles, wheelchairs, surveillance cameras, and zero turning radius lawn mowers. This is a joystick very similar to the analog joysticks on PS2 controllers. Directional movements are simply two potentiometers, one for each axis. Pots are 10k Ohm each. This joystick also has a select button that is actuated when the joystick is pressed down.
DL2210Mk04
1 x Adafruit HUZZAH32 – ESP32 Feather
1 x Lithium Ion Battery – 2500mAh
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x SparkFun Cerberus USB Cable
ESP32 Feather
JY0 – Analog A0
JY1 – Analog A5
SE0 – Digital 12
LED – Digital 13
VIN – +3.3V
GND – GND
——
DL2210Mk04p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #24 - RTOS - Bluetooth - Mk03 24-03 DL2210Mk04p.ino 1 x Adafruit HUZZAH32 – ESP32 Feather 1 x Lithium Ion Battery - 2500mAh 1 x Thumb Joystick 1 x SparkFun Thumb Joystick Breakout 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // FreeRTOS ESP32 #if CONFIG_FREERTOS_UNICORE #define ARDUINO_RUNNING_CORE 0 #else #define ARDUINO_RUNNING_CORE 1 #endif // ESP32 BLE Keyboard #include <BleKeyboard.h> // ESP32 BLE Keyboard BleKeyboard bleKeyboard; // Connections to joystick // Vertical const int VERT = A0; // Horizontal const int HORIZ = A5; // Pushbutton const int SEL = 12; // Initialize variables for analog and digital values int vertical; int horizontal; int selec; // Led Built In #ifndef LED_BUILTIN #define LED_BUILTIN 13 #endif // Define two tasks for Blink void isTaskBlink( void *pvParameters ); // Software Version Information String sver = "24-03"; void loop() { // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Thumb Joystick isThumbJoystick(); } // Delay delay( 1000 ); }
getTasks.ino
// Tasks // Setup Task void isSetupTask(){ // Now set up two tasks to run independently // TaskBlink xTaskCreatePinnedToCore( isTaskBlink , "TaskBlink" // A name just for humans , 1024 // This stack size can be checked & adjusted by reading. , NULL , 2 // Priority, with 2 being the highest, and 0 being the lowest. , NULL , ARDUINO_RUNNING_CORE); // Now the task scheduler, which takes over control of scheduling individual tasks, // is automatically started. } // This is a Task Blink void isTaskBlink(void *pvParameters) { (void) pvParameters; // Blink // Turns on an LED on for 2 second, then off for 2 second, repeatedly // Initialize digital LED_BUILTIN on pin 13 as an output. pinMode(LED_BUILTIN, OUTPUT); // A Task shall never return or exit for (;;) { // Turn the LED on (HIGH is the voltage level) digitalWrite(LED_BUILTIN, HIGH); // One tick delay in between reads vTaskDelay(2000); // Turn the LED off by making the voltage LOW digitalWrite(LED_BUILTIN, LOW); // One tick delay in between reads vTaskDelay(2000); } }
getThumbJoystick.ino
// Thumb Joystick void isThumbJoystick() { // Read all values from the joystick // Joystick was sitting around 2047 for the vertical and horizontal values // Will be 0-4095 // Vertical vertical = analogRead(VERT); if (vertical == 4095) { // Volume Up bleKeyboard.write(KEY_MEDIA_VOLUME_UP); } else if (vertical == 0) { // Volume Down bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN); } // Horizontal // Will be 0-4095 horizontal = analogRead(HORIZ); if (horizontal == 4095) { // Previous Track bleKeyboard.write(KEY_MEDIA_PREVIOUS_TRACK); } else if (horizontal == 0) { // Next Track bleKeyboard.write(KEY_MEDIA_NEXT_TRACK); } // Will be HIGH (1) if not pressed, and LOW (0) if pressed selec = digitalRead(SEL); if (selec == 0) { // Play/Pause media key bleKeyboard.write(KEY_MEDIA_PLAY_PAUSE); } }
setup.ino
// Setup void setup() { // Make the SEL line an input pinMode(SEL, INPUT_PULLUP); // ESP32 BLE Keyboard bleKeyboard.begin(); // Setup Task isSetupTask(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #24 – RTOS – FreeRTOS – Mk01
——
#DonLucElectronics #DonLuc #ESP32 #RTOS #FreeRTOS #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Real-Time Operating System
A real-time operating system (RTOS) is an operating system for real-time applications that processes data and events that have critically defined time constraints. A RTOS is distinct from a time-sharing operating system, such as Unix, which manages the sharing of system resources with a scheduler, data buffers, or fixed task prioritization in a multitasking or multiprogramming environment. Processing time requirements need to be fully understood and bound rather than just kept as a minimum. All processing must occur within the defined constraints. Real-time operating systems are event-driven and preemptive, meaning the OS is capable of monitoring the relevant priority of competing tasks, and make changes to the task priority. Event-driven systems switch between tasks based on their priorities, while time-sharing systems switch the task based on clock interrupts.
FreeRTOS
FreeRTOS is a real-time operating system kernel for embedded devices that has been ported to 35 microcontroller platforms. It is distributed under the MIT License. FreeRTOS is designed to be small and simple. It is mostly written in the C programming language to make it easy to port and maintain. It also comprises a few assembly language functions where needed, mostly in architecture-specific scheduler routines.
FreeRTOS is ideally suited to deeply embedded real-time applications that use microcontrollers or small microprocessors. This type of application normally includes a mix of both hard and soft real-time requirements. Soft real-time requirements are those that state a time deadline, but breaching the deadline would not render the system useless. For example, responding to keystrokes too slowly might make a system seem annoyingly unresponsive without actually making it unusable.
DL2210Mk02
1 x Adafruit HUZZAH32 – ESP32 Feather
1 x 100K Potentiometer
1 x Knob
1 x SparkFun Cerberus USB Cable
ESP32 Feather
PO0 – Analog A0
LED – Digital 13
VIN – +3.3V
GND – GND
DL2210Mk02p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #24 - RTOS - FreeRTOS - Mk01 24-01 DL2210Mk02p.ino 1 x Adafruit HUZZAH32 – ESP32 Feather 1 x 100K Potentiometer 1 x Knob 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // FreeRTOS ESP32 #if CONFIG_FREERTOS_UNICORE #define ARDUINO_RUNNING_CORE 0 #else #define ARDUINO_RUNNING_CORE 1 #endif // Led Built In #ifndef LED_BUILTIN #define LED_BUILTIN 13 #endif // Define two tasks for Blink & AnalogRead void isTaskBlink( void *pvParameters ); void isTaskAnalogReadA0( void *pvParameters ); // Software Version Information String sver = "24-01"; void loop() { // Empty // Things are done in Tasks }
getTasks.ino
// Tasks // This is a Task Blink void isTaskBlink(void *pvParameters) { (void) pvParameters; // Blink // Turns on an LED on for 2 second, then off for 2 second, repeatedly // Initialize digital LED_BUILTIN on pin 13 as an output. pinMode(LED_BUILTIN, OUTPUT); // A Task shall never return or exit for (;;) { // Turn the LED on (HIGH is the voltage level) digitalWrite(LED_BUILTIN, HIGH); // One tick delay in between reads vTaskDelay(2000); // Turn the LED off by making the voltage LOW digitalWrite(LED_BUILTIN, LOW); // One tick delay in between reads vTaskDelay(2000); } } // This is a Task Analog Read Serial void isTaskAnalogReadA0(void *pvParameters) { (void) pvParameters; // Analog Read Serial // Reads an analog input on pin A0, prints the result to the serial monitor for (;;) { // Read the input on analog pin A0 int sensorValueA0 = analogRead(A0); // Print out the value you read Serial.print( "Pot A0: " ); Serial.println(sensorValueA0); // One tick delay (15ms) in between reads for stability vTaskDelay(100); } }
setup.ino
// Setup void setup() { // Initialize serial communication // at 115200 bits per second Serial.begin(115200); // Now set up two tasks to run independently // TaskBlink xTaskCreatePinnedToCore( isTaskBlink , "TaskBlink" // A name just for humans , 1024 // This stack size can be checked & adjusted by reading. , NULL , 2 // Priority, with 2 being the highest, and 0 being the lowest. , NULL , ARDUINO_RUNNING_CORE); // AnalogReadA0 xTaskCreatePinnedToCore( isTaskAnalogReadA0 , "AnalogReadA0" , 1024 // Stack size , NULL , 1 // Priority , NULL , ARDUINO_RUNNING_CORE); // Now the task scheduler, which takes over control of scheduling individual tasks, // is automatically started. }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #16: Sound – Bluetooth – Mk21
——
#DonLucElectronics #DonLuc #ESP32 #Bluetooth #ThumbJoystick #Keyboard #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Bluetooth
Bluetooth is a short-range wireless technology standard that is used for exchanging data between fixed and mobile devices over short distances and building personal area networks. It employs UHF radio waves in the ISM bands, from 2.402 GHz to 2.48 GHz. It is mainly used as an alternative to wire connections, to exchange files between nearby portable devices, computer and connect cell phones and music players with wireless headphones. In the most widely used mode, transmission power is limited to 2.5 milliwatts, giving it a very short range of up to 10 metres.
DL2210Mk01
1 x Adafruit HUZZAH32 – ESP32 Feather
1 x Lithium Ion Battery – 2500mAh
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x SparkFun Cerberus USB Cable
ESP32 Feather
JY0 – Analog A0
JY1 – Analog A5
SE0 – Digital 13
VIN – +3.3V
GND – GND
——
DL2210Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #16: Sound - Bluetooth - Mk21 16-21 DL2210Mk01p.ino 1 x Adafruit HUZZAH32 – ESP32 Feather 1 x Lithium Ion Battery - 2500mAh 1 x Thumb Joystick 1 x SparkFun Thumb Joystick Breakout 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // ESP32 BLE Keyboard #include <BleKeyboard.h> // ESP32 BLE Keyboard BleKeyboard bleKeyboard; // Connections to joystick // Vertical const int VERT = A0; // Horizontal const int HORIZ = A5; // Pushbutton const int SEL = 13; // Initialize variables for analog and digital values int vertical; int horizontal; int selec; // Software Version Information String sver = "16-21"; void loop() { // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Thumb Joystick isThumbJoystick(); } // Delay delay( 1000 ); }
getThumbJoystick.ino
// Thumb Joystick void isThumbJoystick() { // Read all values from the joystick // Joystick was sitting around 2047 for the vertical and horizontal values // Will be 0-4095 // Vertical vertical = analogRead(VERT); if (vertical == 4095) { // Volume Up bleKeyboard.write(KEY_MEDIA_VOLUME_UP); } else if (vertical == 0) { // Volume Down bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN); } // Horizontal // Will be 0-4095 horizontal = analogRead(HORIZ); if (horizontal == 4095) { // Previous Track bleKeyboard.write(KEY_MEDIA_PREVIOUS_TRACK); } else if (horizontal == 0) { // Next Track bleKeyboard.write(KEY_MEDIA_NEXT_TRACK); } // Will be HIGH (1) if not pressed, and LOW (0) if pressed selec = digitalRead(SEL); if (selec == 0) { // Play/Pause media key bleKeyboard.write(KEY_MEDIA_PLAY_PAUSE); } }
setup.ino
// Setup void setup() { // Make the SEL line an input pinMode(SEL, INPUT_PULLUP); // ESP32 BLE Keyboard bleKeyboard.begin(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc