The Alpha Geek – Geeking Out

Adafruit

Adafruit

Project #26 – Radio Frequency – Gamepad Tester – Mk14

——

#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #JoystickTest #Gamepad #ESP32 #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Gamepad Tester

——

Gamepad Tester

——

Gamepad Tester

——

Controller & Gamepad Tester

Controller 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

——

Joystick Test Application

——

Joystick Test Application

——

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

——

Gamepad

——

Gamepad

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

Instructor, E-Mentor, STEAM, and Arts-Based Training

——

#DonLucElectronics #DonLuc #Instructor #E-Mentor #STEAM #ArtsBasedTraining #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Instructor, E-Mentor, STEAM, and Arts-Based Training

——

Instructor, E-Mentor, STEAM, and Arts-Based Training

——

Instructor, E-Mentor, STEAM, and Arts-Based Training

——

Instructor, E-Mentor, STEAM, and Arts-Based Training

——

What do remote controllers, routers, and robots all have in common? These beginner-friendly microcontrollers are easy to use and program with just a computers or laptop, a USB cable, and some open-source software. All the projects, here we come. Whether you are looking to build some cool electronic projects, learn programming, or wanting to teach others about electronics, this a teaching session will help you figure out what microcontroller is right for your needs, goals, and budgets. Here is some helpful content to start you on your electronics journey. There are different microcontrollers and it can be daunting to get started, especially if you’re just getting into electronics.

  • Arduino Uno – R3, SparkFun RedBoard, Arduino Fio, LilyPad Arduino, FLORA, Adafruit METRO 328, Arduino Pro Mini 328, Adafruit Metro Mini 328, Adafruit Pro Trinket, Adafruit Feather 328P, Moteino, etcetera, is a microcontroller board based on the ATmega328 (5V/16MHz, 3.3V/8MHz).
  • SparkFun Pro Micro, SparkFun Fio V3, Adafruit ItsyBitsy 32u4, Adafruit Feather 32u4, Circuit Playground Classic, etcetera, is a microcontroller board based on the ATmega32U4 (5V/16MHz, 3.3V/8MHz).
  • Arduino Mega 2560 R3 is a microcontroller board based on the ATmega2560 (5V/16MHz).
  • Arduino Nano Every is a microcontroller board based on the ATMega 4809 (5V/20MHz).
  • Arduino Due is a microcontroller board based on the AT91SAM3X8E (3.3V/84MHz).
  • SparkFun RedBoard Turbo, SparkFun SAMD21 Mini Breakout, Adafruit METRO M0 Express, LilyPad Simblee BLE, etcetera, is a microcontroller board based on the ATSAMD21G18 ARM Cortex M0+ (3.3V/48MHz).
  • SparkFun Thing Plus – SAMD51, Adafruit Metro M4 Express, Adafruit Feather M4 Express, etcetera, is a microcontroller board based on the ATSAMD51 Cortex M4 (3.3V/120MHz).
  • SparkFun Thing Plus – ESP32 WROOM, Adafruit HUZZAH32 – ESP32 Feather Board, etcetera, is a microcontroller board based on the Espressif Xtensa® dual-core 32-bit LX6 (3.3V/240MHz).
  • Raspberry Pi 4 Model B is a microcontroller board based on the Broadcom BCM2711, quad-core Cortex-A72 (ARM v8) 64-bit SoC (5.1V/1.5GHz).
  • Raspberry Pi Zero W is a microcontroller board based on the Broadcom BCM2837B0 64-bit ARM Cortex-A53 Quad Core Processor SoC (5.1V/1GHz).
  • Etcetera…

At Don Luc Electronics I believe that an understanding of electronics is a core literacy that opens up a world of opportunities in the fields of robotics, Internet of Things (IoT), machine learning, engineering, fashion, medical industries, environmental sciences, performing arts and more. This guide is designed to explore the connection between software and hardware, introducing code and parts as they are used in the context of building engaging projects. The circuits in this guide progress in difficulty as new concepts and components are introduced. Completing each circuit means much more than just experimenting you will walk away with a fun project you can use and a sense of accomplishment that is just the beginning of your electronics journey. At the end of each circuit, you’ll find coding challenges that extend your learning and fuel ongoing innovation.

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

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/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 – Bluetooth – Mk03

——

#DonLucElectronics #DonLuc #ESP32 #RTOS #FreeRTOS #Bluetooth #ThumbJoystick #Keyboard #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Bluetooth

——

Bluetooth

——

Bluetooth

——

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

——

FreeRTOS

——

FreeRTOS

——

FreeRTOS

——

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

——

Bluetooth

——

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

Project #21 – Nixie – Stopwatch – Mk04

——

#DonLucElectronics #DonLuc #NixieTube #Nixie #ArduiNIX #ArduinoMega2560 #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Stopwatch

——

Stopwatch

——

Stopwatch

——

Stopwatch

A stopwatch is a timepiece designed to measure the amount of time that elapses between its activation and deactivation. In manual timing, the clock is started and stopped by a person pressing a button. The timing functions are traditionally controlled by two buttons on the case. Pressing the top button starts the timer running, and pressing the button a second time stops it, leaving the elapsed time displayed. A press of the second button then resets the stopwatch to zero. The second button is also used to record split times or lap times. When the split time button is pressed while the watch is running it allows the elapsed time to that point to be read, but the watch mechanism continues running to record total elapsed time. Pressing the split button a second time allows the watch to resume display of total time.

DL2209Mk04

1 x Arduino Mega 2560 R2
1 x ArduiNIX V3 Tube Driver Shield Kit
1 x IN-17×8 V1 Tube Board Kit
1 x Anode / Cathode Connector Cable Set
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 12mm Coin Cell Battery
2 x Rocker Switch – SPST
5 x 10K Ohm
1 x Momentary Button – Panel Mount (Blue)
2 x Momentary Button – Panel Mount (Black)
1 x SparkFun ProtoShield
1 x 9V 1000mA Power Supply
1 x SparkFun Cerberus USB Cable

Arduino Mega 2560 R2

SN2 – 2
SN3 – 3
SN4 – 4
SN5 – 5
SN6 – 6
SN7 – 7
SN8 – 8
SN9 – 9
AN10 – 10
AN11 – 11
AN12 – 12
AN13 – 13
SDA – 20
SCL – 21
RO0 – 53
RO1 – 51
MB0 = 49
MB1 = 47
MB2 = 45
VIN – +3.3V
VIN – +5V
VIN – +9V
GND – GND

DL2209Mk04p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #21 - Nixie - Stopwatch - Mk04
21-04
DL2209Mk04p.ino
1 x Arduino Mega 2560 R2
1 x ArduiNIX V3 Tube Driver Shield Kit
1 x IN-17x8 V1 Tube Board Kit
1 x Anode / Cathode Connector Cable Set
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 12mm Coin Cell Battery
2 x Rocker Switch - SPST
5 x 10K Ohm
1 x Momentary Button - Panel Mount (Blue)
2 x Momentary Button - Panel Mount (Black)
1 x 9V 1000mA Power Supply
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Wire you to communicate with I2C/TWI devices
// Date and Time DS3231 RTC
#include "RTClib.h"

// SN74141 (1)
int ledPin_0_a = 2;                
int ledPin_0_b = 3;
int ledPin_0_c = 4;
int ledPin_0_d = 5;

// SN74141 (2)
int ledPin_1_a = 6;                
int ledPin_1_b = 7;
int ledPin_1_c = 8;
int ledPin_1_d = 9;

// Anode pins
int ledPin_a_1 = 10;
int ledPin_a_2 = 11;
int ledPin_a_3 = 12;
int ledPin_a_4 = 13;

// Fade
float fadeMax = 0.1f;
float fadeStep = 0.1f;
// Number Array
int NumberArray[8]={0,0,0,0,0,0,0,0};
int currNumberArray[8]={0,0,0,0,0,0,0,0};
float NumberArrayFadeInValue[8]={0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f};
float NumberArrayFadeOutValue[8]={5.0f,5.0f,5.0f,5.0f,5.0f,5.0f,5.0f,5.0f};

// Date and time functions using a DS3231 RTC
RTC_DS3231 RTC;

// Rocker Switch - SPST
// Rocker Switch 0
const int iRO0 = 53;
// State
int iRO0State = 0;
// Rocker Switch 1
const int iRO1 = 51;
// State
int iRO1State = 0;

// Momentary Button
const int iStartP = 49;
const int iStopP = 47;
const int iResetP = 45;

// Setting hours, minutes, secound and miliseconds to 0
int iH = 0;
int iM = 0;
int iS = 0;
int iMS = 0;
int iMSS = 0;

// Defines starting points
int iStart = 0;
int iStop1 = 0;
int iReset = 0;

// Get the high and low order values for hours,min,seconds. 
int lowerHours = 0;
int upperHours = 0;
int lowerMins = 0;
int upperMins = 0;
int lowerSeconds = 0;
int upperSeconds = 0;
int lowerMiliseconds = 0;
int upperMiliseconds = 0;

// Software Version Information
String sver = "21-04";

void loop() {

  // Read the state of the Switch value
  iRO1State = digitalRead(iRO1);
  
  // If it is the Switch State is HIGH
  if (iRO1State == HIGH) {
  
    // Stopwatch
    isStart();

  } else {

    // Date ans Time
    isTimeRTC();
    
  }

}

getDisplayFadeNumber.ino

// Display Fade Number
void DisplayFadeNumberString()
{
 
  // Anode channel 1 - numerals 0,4
  SetSN74141Chips(currNumberArray[0],currNumberArray[4]);   
  digitalWrite(ledPin_a_1, HIGH);   
  delay(NumberArrayFadeOutValue[0]);
  SetSN74141Chips(NumberArray[0],NumberArray[4]);   
  delay(NumberArrayFadeInValue[0]);
  digitalWrite(ledPin_a_1, LOW);
  
  // Anode channel 2 - numerals 1,5
  SetSN74141Chips(currNumberArray[1],currNumberArray[5]);   
  digitalWrite(ledPin_a_2, HIGH);   
  delay(NumberArrayFadeOutValue[1]);
  SetSN74141Chips(NumberArray[1],NumberArray[5]);   
  delay(NumberArrayFadeInValue[1]);
  digitalWrite(ledPin_a_2, LOW);
  
  // Anode channel 3 - numerals 2,6
  SetSN74141Chips(currNumberArray[2],currNumberArray[6]);   
  digitalWrite(ledPin_a_3, HIGH);   
  delay(NumberArrayFadeOutValue[2]);
  SetSN74141Chips(NumberArray[2],NumberArray[6]);   
  delay(NumberArrayFadeInValue[2]);
  digitalWrite(ledPin_a_3, LOW);
  
  // Anode channel 4 - numerals 3,7
  SetSN74141Chips(currNumberArray[3],currNumberArray[7]);   
  digitalWrite(ledPin_a_4, HIGH);   
  delay(NumberArrayFadeOutValue[3]);
  SetSN74141Chips(NumberArray[3],NumberArray[7]);   
  delay(NumberArrayFadeInValue[3]);
  digitalWrite(ledPin_a_4, LOW);
  
  // Loop thru and update all the arrays, and fades.
  for( int i = 0 ; i < 8 ; i ++ ) //equal to & of digits
  {
    if( NumberArray[i] != currNumberArray[i] )
    {
      NumberArrayFadeInValue[i] += fadeStep;
      NumberArrayFadeOutValue[i] -= fadeStep;
  
      if( NumberArrayFadeInValue[i] >= fadeMax )
      {
        NumberArrayFadeInValue[i] = 2.0f;
        NumberArrayFadeOutValue[i] = 4.0f; //affects the refresh cycle
        currNumberArray[i] = NumberArray[i];
      }
    }
  }
  
}

getRTCDS3231.ino

// DS3231 Precision RTC
// Setup RTC
void setupRTC() {

  // DS3231 Precision RTC   
  RTC.begin();
  if (! RTC.begin() ) {
    while (1) delay(10);
  }

  if (RTC.lostPower()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // August 2, 2021 at 13:53:0 you would call:
    // RTC.adjust(DateTime(2022, 4, 26, 11, 39, 0));
    
  }
  
}
// Date ans Time - isTimeRTC
void isTimeRTC() {

  // Date and Time
  DateTime now = RTC.now();

  // Read the state of the Switch value
  iRO0State = digitalRead(iRO0);
  
  // If it is the Switch State is HIGH
  if (iRO0State == HIGH) {


    // Get the high and low order values for hours, minute, seconds
    int lowerHours = now.hour() % 10;
    int upperHours = now.hour() - lowerHours;
    int lowerMins = now.minute() % 10;
    int upperMins = now.minute() - lowerMins;
    int lowerSeconds = now.second() % 10;
    int upperSeconds = now.second() - lowerSeconds;
    
    // 10 >= hours, minute, seconds
    if( upperSeconds >= 10 )   upperSeconds = upperSeconds / 10;
    if( upperMins >= 10 )      upperMins = upperMins / 10;
    if( upperHours >= 10 )     upperHours = upperHours / 10;
    if( upperHours == 0 && lowerHours == 0 )
    {
      
      upperHours = 1;
      lowerHours = 2;
      
    }

    // Fill in the Number array used to display on the Nixie tubes
    NumberArray[7] = upperHours;
    NumberArray[6] = lowerHours;
    NumberArray[5] = 0;
    NumberArray[4] = upperMins;
    NumberArray[3] = lowerMins;
    NumberArray[2] = 0;
    NumberArray[1] = upperSeconds; 
    NumberArray[0] = lowerSeconds;

  } else {

    // Get the high and low order values for year, month, day
    int iYear = now.year() - 2000;
    int lowerYear = iYear % 10;
    int upperYear = iYear - lowerYear;
    int lowerMonth = now.month() % 10;
    int upperMonth = now.month() - lowerMonth;
    int lowerDay = now.day() % 10;
    int upperDay = now.day() - lowerDay;

    // 10 >= year, month, day
    if( upperDay >= 10 )   upperDay = upperDay / 10;
    if( upperMonth >= 10 )      upperMonth = upperMonth / 10;
    if( upperYear >= 10 )     upperYear = upperYear / 10;

    // Fill in the Number array used to display on the Nixie tubes
    NumberArray[7] = 2;
    NumberArray[6] = 0;
    NumberArray[5] = upperYear;
    NumberArray[4] = lowerYear;
    NumberArray[3] = upperMonth;
    NumberArray[2] = lowerMonth;
    NumberArray[1] = upperDay; 
    NumberArray[0] = lowerDay;
  
  }
  
  // Display
  DisplayFadeNumberString();
  
}

getSN74141.ino

// SN74141
// SN74141 : Truth Table
//D C B A #
//L,L,L,L 0
//L,L,L,H 1
//L,L,H,L 2
//L,L,H,H 3
//L,H,L,L 4
//L,H,L,H 5
//L,H,H,L 6
//L,H,H,H 7
//H,L,L,L 8
//H,L,L,H 9
// isSetupSN74141
void isSetupSN74141(){

  pinMode(ledPin_0_a, OUTPUT);      
  pinMode(ledPin_0_b, OUTPUT);      
  pinMode(ledPin_0_c, OUTPUT);      
  pinMode(ledPin_0_d, OUTPUT);    
  
  pinMode(ledPin_1_a, OUTPUT);      
  pinMode(ledPin_1_b, OUTPUT);      
  pinMode(ledPin_1_c, OUTPUT);      
  pinMode(ledPin_1_d, OUTPUT);      
  
  pinMode(ledPin_a_1, OUTPUT);      
  pinMode(ledPin_a_2, OUTPUT);      
  pinMode(ledPin_a_3, OUTPUT);   
  pinMode(ledPin_a_4, OUTPUT);    

}
// SetSN74141Chips
void SetSN74141Chips( int num2, int num1 )
{
  
  // Set defaults
  // Will display a zero.
  int a = 0;
  int b = 0;
  int c = 0;
  int d = 0;
  
  // Load the a,b,c,d.. to send to the SN74141 IC (1)
  switch( num1 )
  {
    case 0:
      a=0;
      b=0;
      c=0;
      d=0;
      break;
    case 1:
      a=1;
      b=0;
      c=0;
      d=0;
      break;
    case 2:
      a=0;
      b=1;
      c=0;
      d=0;
      break;
    case 3:
      a=1;
      b=1;
      c=0;
      d=0;
      break;
    case 4:
      a=0;
      b=0;
      c=1;
      d=0;
      break;
    case 5:
      a=1;
      b=0;
      c=1;
      d=0;
      break;
    case 6: 
      a=0;
      b=1;
      c=1;
      d=0;
      break;
    case 7:
      a=1;
      b=1;
      c=1;
      d=0;
      break;
    case 8:
      a=0;
      b=0;
      c=0;
      d=1;
      break;
    case 9:
      a=1;
      b=0;
      c=0;
      d=1;
      break;
    default:
      a=1;
      b=1;
      c=1;
      d=1;
      break;
  }  
  
  // Write to output pins.
  digitalWrite(ledPin_0_d, d);
  digitalWrite(ledPin_0_c, c);
  digitalWrite(ledPin_0_b, b);
  digitalWrite(ledPin_0_a, a);

  // Load the a,b,c,d.. to send to the SN74141 IC (2)
  switch( num2 )
  {
    case 0:
      a=0;
      b=0;
      c=0;
      d=0;
      break;
    case 1:
      a=1;
      b=0;
      c=0;
      d=0;
      break;
    case 2:
      a=0;
      b=1;
      c=0;
      d=0;
      break;
    case 3:
      a=1;
      b=1;
      c=0;
      d=0;
      break;
    case 4:
      a=0;
      b=0;
      c=1;
      d=0;
      break;
    case 5:
      a=1;
      b=0;
      c=1;
      d=0;
      break;
    case 6:
      a=0;
      b=1;
      c=1;
      d=0;
      break;
    case 7:
      a=1;
      b=1;
      c=1;
      d=0;
      break;
    case 8:
      a=0;
      b=0;
      c=0;
      d=1;
      break;
    case 9:
      a=1;
      b=0;
      c=0;
      d=1;
      break;
    default:
      a=1;
      b=1;
      c=1;
      d=1;
      break;
  }
  
  // Write to output pins
  digitalWrite(ledPin_1_d, d);
  digitalWrite(ledPin_1_c, c);
  digitalWrite(ledPin_1_b, b);
  digitalWrite(ledPin_1_a, a);
  
}

getStopwatch.ino

// Stopwatch
// Setup Stopwatch
void isSetupStopwatch(){

  // Switch
  pinMode(iRO0, INPUT);
  pinMode(iRO1, INPUT);

  // Momentary Button
  pinMode(iStartP, INPUT);
  pinMode(iStopP, INPUT);
  pinMode(iResetP, INPUT);
  
}
// Start
void isStart()
{

  // Reading buton state iStart
  iStart = digitalRead(iStartP);
  if(iStart == HIGH) 
  {

    // Calls the isStopWatch function
    isStopWatch();

 }

}
// Stop Watch
void isStopWatch()
{

  // Miliseconds
  iMS = iMS + 10;     
  if(iMS == 600)           
  {
   
    iMS = 0;
    iMSS = 0;
    iS = iS + 1;
    
  } else if (iMS == 60) { // 1

    iMSS = iMSS + 1;
    
  } else if (iMS == 120) { // 2

    iMSS = iMSS + 1;
    
  } else if (iMS == 180) { //3 

    iMSS = iMSS + 1;
    
  } else if (iMS == 240) { // 4

    iMSS = iMSS + 1;
    
  } else if (iMS == 300) { // 5

    iMSS = iMSS + 1;
    
  } else if (iMS == 360) { // 6

    iMSS = iMSS + 1;
    
  } else if (iMS == 420) { // 7

    iMSS = iMSS + 1;
    
  } else if (iMS == 480) { // 8

    iMSS = iMSS + 1;
    
  } else if (iMS == 540) { // 9

    iMSS = iMSS + 1;
    
  }
  // If state for counting up minutes
  if( iS == 60)
  { 
  
    iS = 0;
    iM = iM + 1;
    
  }
  // If state for counting up hours
  if( iM == 60)
  {  
    
    iM = 0;
    iH = iH + 01;
    
  }

  // Get the high and low order values for hours, minute, seconds, Miliseconds
  int lowerHours = iH % 10;
  int upperHours = iH - lowerHours;
  int lowerMins = iM % 10;
  int upperMins = iM - lowerMins;
  int lowerSeconds = iS % 10;
  int upperSeconds = iS - lowerSeconds;
  int lowerMiliseconds = iMSS;
  int upperMiliseconds = iMSS - lowerMiliseconds;
    
  // 10 >= hours, minute, seconds, Miliseconds
  if( upperSeconds >= 10 )   upperSeconds = upperSeconds / 10;
  if( upperMins >= 10 )      upperMins = upperMins / 10;
  if( upperHours >= 10 )     upperHours = upperHours / 10;

  // Fill in the Number array used to display on the Nixie tubes
  NumberArray[7] = upperHours;
  NumberArray[6] = lowerHours;
  NumberArray[5] = upperMins;
  NumberArray[4] = lowerMins;
  NumberArray[3] = upperSeconds;
  NumberArray[2] = lowerSeconds;
  NumberArray[1] = lowerMiliseconds; 
  NumberArray[0] = lowerMiliseconds;

  // Display
  DisplayFadeNumberString();
    
  // Reading buton state Stop
  iStop1 = digitalRead(iStopP);
  // Checking if button is pressed
  if(iStop1 == HIGH)
  {
    
    // Calls the isStopwatchStop function
    isStopwatchStop();
    
  }
  else
  {

    // Calls the isStopWatch function
    isStopWatch();
    
  }
  
}
// Stopwatch Stop
void isStopwatchStop()
{

  // Get the high and low order values for hours, minute, seconds, Miliseconds
  int lowerHours = iH % 10;
  int upperHours = iH - lowerHours;
  int lowerMins = iM % 10;
  int upperMins = iM - lowerMins;
  int lowerSeconds = iS % 10;
  int upperSeconds = iS - lowerSeconds;
  int lowerMiliseconds = iMSS;
  int upperMiliseconds = iMSS - lowerMiliseconds;
    
  // 10 >= hours, minute, seconds, Miliseconds
  if( upperSeconds >= 10 )   upperSeconds = upperSeconds / 10;
  if( upperMins >= 10 )      upperMins = upperMins / 10;
  if( upperHours >= 10 )     upperHours = upperHours / 10;
 
  // Fill in the Number array used to display on the Nixie tubes
  NumberArray[7] = upperHours;
  NumberArray[6] = lowerHours;
  NumberArray[5] = upperMins;
  NumberArray[4] = lowerMins;
  NumberArray[3] = upperSeconds;
  NumberArray[2] = lowerSeconds;
  NumberArray[1] = lowerMiliseconds; 
  NumberArray[0] = lowerMiliseconds;

  // Display
  DisplayFadeNumberString();
  
  // Reading buton state iStart
  iStart = digitalRead(iStartP);
  if(iStart == HIGH)
  {
    
    // Calls the isStopWatch function 
    isStopWatch();

  } 
  // Reading buton state
  iReset = digitalRead(iResetP);
  if(iReset == HIGH)
  {
   
     // Calls the isStopwatchReset function
     isStopwatchReset();
     loop();
   
  }
  if(iReset == LOW)
  {
    
    // Calls the isStopwatchStop function
    isStopwatchStop();
    
  }

}
// Stopwatch Reset
void isStopwatchReset()
{

   // Seting hours to 0
   iH = 0;
   // Seting minutes to 0
   iM = 0;
   // Seting seconds to 0
   iS = 0;
   // Seting miliseconds to 0
   iMS = 0;
   // Seting miliseconds to 0
   iMSS = 0;
   
   // Fill in the Number array used to display on the Nixie tubes
   NumberArray[7] = 0;
   NumberArray[6] = 0;
   NumberArray[5] = 0;
   NumberArray[4] = 0;
   NumberArray[3] = 0;
   NumberArray[2] = 0;
   NumberArray[1] = 0; 
   NumberArray[0] = 0;
   // Display
   DisplayFadeNumberString();
   // Exiting the program and returning to the point where entered the program
   return;
   
}

setup.ino

// Setup
void setup() {

  // isSetupSN74141
  isSetupSN74141();

  // Setup Stopwatch
  isSetupStopwatch();

  // Setup RTC
  setupRTC();

}

——

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 #21 – Nixie – DS3231 Precision RTC – Mk03

——

#DonLucElectronics #DonLuc #NixieTube #Nixie #ArduiNIX #ArduinoUNO #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

DS3231 Precision RTC

——

DS3231 Precision RTC

——

DS3231 Precision RTC

——

DS3231 Precision RTC FeatherWing

The datasheet for the DS3231 explains that this part is an extremely accurate I²C – Integrated RTC TCXO – crystal. This Real Time Clock (RTC) is the most precise you can get in a small, low power package. Most RTC’s use an external 32kHz timing crystal that is used to keep time with low current draw. That’s all well and good, but those crystals have slight drift, particularly when the temperature changes, the temperature changes the oscillation frequency very slightly but it does add up. This RTC is in a beefy package because the crystal is inside the chip. And right next to the integrated crystal is a temperature sensor. That sensor compensates for the frequency changes by adding or removing clock ticks so that the time keeping stays on schedule.

This is the finest RTC you can get, and now we have it in a compact, breadboard friendly breakout. With a coin cell plugged into the back, you can get years of precision time keeping, even when main power is lost. Great for datalogging and clocks, or anything where you need to really know the time.

DL2209Mk03

1 x Arduino Mega 2560 R2
1 x ArduiNIX V3 Tube Driver Shield Kit
1 x IN-17×8 V1 Tube Board Kit
1 x Anode / Cathode Connector Cable Set
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 12mm Coin Cell Battery
1 x Rocker Switch – SPST
1 x 10K Ohm
1 x SparkFun ProtoShield
1 x 9V 1000mA Power Supply
1 x SparkFun Cerberus USB Cable

Arduino Mega 2560 R2

SN2 – 2
SN3 – 3
SN4 – 4
SN5 – 5
SN6 – 6
SN7 – 7
SN8 – 8
SN9 – 9
AN10 – 10
AN11 – 11
AN12 – 12
AN13 – 13
VI14 – 14
VI15 – 15
SDA – 20
SCL – 21
RO0 – 53
VIN – +3.3V
VIN – +5V
VIN – +9V
GND – GND

DL2209Mk03p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #21 - Nixie - DS3231 Precision RTC - Mk03
21-03
DL2209Mk03p.ino
1 x Arduino Mega 2560 R2
1 x ArduiNIX V3 Tube Driver Shield Kit
1 x IN-17x8 V1 Tube Board Kit
1 x Anode / Cathode Connector Cable Set
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 12mm Coin Cell Battery
1 x Rocker Switch - SPST
1 x 10K Ohm
1 x 9V 1000mA Power Supply
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Wire you to communicate with I2C/TWI devices
// Date and Time DS3231 RTC
#include "RTClib.h"

// SN74141 (1)
int ledPin_0_a = 2;                
int ledPin_0_b = 3;
int ledPin_0_c = 4;
int ledPin_0_d = 5;

// SN74141 (2)
int ledPin_1_a = 6;                
int ledPin_1_b = 7;
int ledPin_1_c = 8;
int ledPin_1_d = 9;

// Anode pins
int ledPin_a_1 = 10;
int ledPin_a_2 = 11;
int ledPin_a_3 = 12;
int ledPin_a_4 = 13;

// NOTE: Grounding on virtual pins 14 and 15 
// (analog pins 0 and 1) will set the Hour and Mins.
int iVirtual14 = 14;
int iVirtual15 = 15;

// Fade
float fadeMax = 0.1f;
float fadeStep = 0.1f;
// Number Array
int NumberArray[8]={0,0,0,0,0,0,0,0};
int currNumberArray[8]={0,0,0,0,0,0,0,0};
float NumberArrayFadeInValue[8]={0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f};
float NumberArrayFadeOutValue[8]={5.0f,5.0f,5.0f,5.0f,5.0f,5.0f,5.0f,5.0f};

// Date and time functions using a DS3231 RTC
RTC_DS3231 RTC;

// Rocker Switch - SPST
int iRO0 = 53;
// State
int iRO0State = 0;

// Software Version Information
String sver = "21-03";

void loop() {

  // timeRTC
  timeRTC();

}

getDisplayFadeNumber.ino

// Display Fade Number
void DisplayFadeNumberString()
{
 
  // Anode channel 1 - numerals 0,4
  SetSN74141Chips(currNumberArray[0],currNumberArray[4]);   
  digitalWrite(ledPin_a_1, HIGH);   
  delay(NumberArrayFadeOutValue[0]);
  SetSN74141Chips(NumberArray[0],NumberArray[4]);   
  delay(NumberArrayFadeInValue[0]);
  digitalWrite(ledPin_a_1, LOW);
  
  // Anode channel 2 - numerals 1,5
  SetSN74141Chips(currNumberArray[1],currNumberArray[5]);   
  digitalWrite(ledPin_a_2, HIGH);   
  delay(NumberArrayFadeOutValue[1]);
  SetSN74141Chips(NumberArray[1],NumberArray[5]);   
  delay(NumberArrayFadeInValue[1]);
  digitalWrite(ledPin_a_2, LOW);
  
  // Anode channel 3 - numerals 2,6
  SetSN74141Chips(currNumberArray[2],currNumberArray[6]);   
  digitalWrite(ledPin_a_3, HIGH);   
  delay(NumberArrayFadeOutValue[2]);
  SetSN74141Chips(NumberArray[2],NumberArray[6]);   
  delay(NumberArrayFadeInValue[2]);
  digitalWrite(ledPin_a_3, LOW);
  
  // Anode channel 4 - numerals 3,7
  SetSN74141Chips(currNumberArray[3],currNumberArray[7]);   
  digitalWrite(ledPin_a_4, HIGH);   
  delay(NumberArrayFadeOutValue[3]);
  SetSN74141Chips(NumberArray[3],NumberArray[7]);   
  delay(NumberArrayFadeInValue[3]);
  digitalWrite(ledPin_a_4, LOW);
  
  // Loop thru and update all the arrays, and fades.
  for( int i = 0 ; i < 8 ; i ++ ) //equal to & of digits
  {
    if( NumberArray[i] != currNumberArray[i] )
    {
      NumberArrayFadeInValue[i] += fadeStep;
      NumberArrayFadeOutValue[i] -= fadeStep;
  
      if( NumberArrayFadeInValue[i] >= fadeMax )
      {
        NumberArrayFadeInValue[i] = 2.0f;
        NumberArrayFadeOutValue[i] = 4.0f; //affects the refresh cycle
        currNumberArray[i] = NumberArray[i];
      }
    }
  }
  
}

getRTCDS3231.ino

// DS3231 Precision RTC
// Setup RTC
void setupRTC() {

  // DS3231 Precision RTC   
  RTC.begin();
  if (! RTC.begin() ) {
    while (1) delay(10);
  }

  if (RTC.lostPower()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // August 2, 2021 at 13:53:0 you would call:
    // RTC.adjust(DateTime(2022, 4, 26, 11, 39, 0));
    
  }
  
}
// timeRTC
void timeRTC() {

  // Date and Time
  DateTime now = RTC.now();

  // Read the state of the Switch value
  iRO0State = digitalRead(iRO0);
  
  // If it is the Switch State is HIGH
  if (iRO0State == HIGH) {


    // Get the high and low order values for hours, minute, seconds
    int lowerHours = now.hour() % 10;
    int upperHours = now.hour() - lowerHours;
    int lowerMins = now.minute() % 10;
    int upperMins = now.minute() - lowerMins;
    int lowerSeconds = now.second() % 10;
    int upperSeconds = now.second() - lowerSeconds;
    
    // 10 >= hours, minute, seconds
    if( upperSeconds >= 10 )   upperSeconds = upperSeconds / 10;
    if( upperMins >= 10 )      upperMins = upperMins / 10;
    if( upperHours >= 10 )     upperHours = upperHours / 10;
    if( upperHours == 0 && lowerHours == 0 )
    {
      
      upperHours = 1;
      lowerHours = 2;
      
    }

    // Fill in the Number array used to display on the Nixie tubes
    NumberArray[7] = upperHours;
    NumberArray[6] = lowerHours;
    NumberArray[5] = 0;
    NumberArray[4] = upperMins;
    NumberArray[3] = lowerMins;
    NumberArray[2] = 0;
    NumberArray[1] = upperSeconds; 
    NumberArray[0] = lowerSeconds;

  } else {

    // Get the high and low order values for year, month, day
    int iYear = now.year() - 2000;
    int lowerYear = iYear % 10;
    int upperYear = iYear - lowerYear;
    int lowerMonth = now.month() % 10;
    int upperMonth = now.month() - lowerMonth;
    int lowerDay = now.day() % 10;
    int upperDay = now.day() - lowerDay;

    // 10 >= year, month, day
    if( upperDay >= 10 )   upperDay = upperDay / 10;
    if( upperMonth >= 10 )      upperMonth = upperMonth / 10;
    if( upperYear >= 10 )     upperYear = upperYear / 10;

    // Fill in the Number array used to display on the Nixie tubes
    NumberArray[7] = 2;
    NumberArray[6] = 0;
    NumberArray[5] = upperYear;
    NumberArray[4] = lowerYear;
    NumberArray[3] = upperMonth;
    NumberArray[2] = lowerMonth;
    NumberArray[1] = upperDay; 
    NumberArray[0] = lowerDay;
  
  }
  
  // Display
  DisplayFadeNumberString();
  
}

getSN74141.ino

// SN74141
// SN74141 : Truth Table
//D C B A #
//L,L,L,L 0
//L,L,L,H 1
//L,L,H,L 2
//L,L,H,H 3
//L,H,L,L 4
//L,H,L,H 5
//L,H,H,L 6
//L,H,H,H 7
//H,L,L,L 8
//H,L,L,H 9
// isSetupSN74141
void isSetupSN74141(){

  pinMode(ledPin_0_a, OUTPUT);      
  pinMode(ledPin_0_b, OUTPUT);      
  pinMode(ledPin_0_c, OUTPUT);      
  pinMode(ledPin_0_d, OUTPUT);    
  
  pinMode(ledPin_1_a, OUTPUT);      
  pinMode(ledPin_1_b, OUTPUT);      
  pinMode(ledPin_1_c, OUTPUT);      
  pinMode(ledPin_1_d, OUTPUT);      
  
  pinMode(ledPin_a_1, OUTPUT);      
  pinMode(ledPin_a_2, OUTPUT);      
  pinMode(ledPin_a_3, OUTPUT);   
  pinMode(ledPin_a_4, OUTPUT);    
 
  // NOTE: Grounding on virtual pins 14 and 15 
  // (analog pins 0 and 1) will set the Hour and Mins.
  // Set the vertual pin 14 (pin 0 on the analog inputs )
  pinMode( iVirtual14, INPUT );
  // Set pin 14 as a pull up resistor.
  digitalWrite(iVirtual14, HIGH);
  // Set the vertual pin 15 (pin 1 on the analog inputs )
  pinMode( iVirtual15, INPUT );
  // Set pin 15 as a pull up resistor.
  digitalWrite(iVirtual15, HIGH);
  
}
// SetSN74141Chips
void SetSN74141Chips( int num2, int num1 )
{
  
  // Set defaults
  // Will display a zero.
  int a = 0;
  int b = 0;
  int c = 0;
  int d = 0;
  
  // Load the a,b,c,d.. to send to the SN74141 IC (1)
  switch( num1 )
  {
    case 0:
      a=0;
      b=0;
      c=0;
      d=0;
      break;
    case 1:
      a=1;
      b=0;
      c=0;
      d=0;
      break;
    case 2:
      a=0;
      b=1;
      c=0;
      d=0;
      break;
    case 3:
      a=1;
      b=1;
      c=0;
      d=0;
      break;
    case 4:
      a=0;
      b=0;
      c=1;
      d=0;
      break;
    case 5:
      a=1;
      b=0;
      c=1;
      d=0;
      break;
    case 6: 
      a=0;
      b=1;
      c=1;
      d=0;
      break;
    case 7:
      a=1;
      b=1;
      c=1;
      d=0;
      break;
    case 8:
      a=0;
      b=0;
      c=0;
      d=1;
      break;
    case 9:
      a=1;
      b=0;
      c=0;
      d=1;
      break;
    default:
      a=1;
      b=1;
      c=1;
      d=1;
      break;
  }  
  
  // Write to output pins.
  digitalWrite(ledPin_0_d, d);
  digitalWrite(ledPin_0_c, c);
  digitalWrite(ledPin_0_b, b);
  digitalWrite(ledPin_0_a, a);

  // Load the a,b,c,d.. to send to the SN74141 IC (2)
  switch( num2 )
  {
    case 0:
      a=0;
      b=0;
      c=0;
      d=0;
      break;
    case 1:
      a=1;
      b=0;
      c=0;
      d=0;
      break;
    case 2:
      a=0;
      b=1;
      c=0;
      d=0;
      break;
    case 3:
      a=1;
      b=1;
      c=0;
      d=0;
      break;
    case 4:
      a=0;
      b=0;
      c=1;
      d=0;
      break;
    case 5:
      a=1;
      b=0;
      c=1;
      d=0;
      break;
    case 6:
      a=0;
      b=1;
      c=1;
      d=0;
      break;
    case 7:
      a=1;
      b=1;
      c=1;
      d=0;
      break;
    case 8:
      a=0;
      b=0;
      c=0;
      d=1;
      break;
    case 9:
      a=1;
      b=0;
      c=0;
      d=1;
      break;
    default:
      a=1;
      b=1;
      c=1;
      d=1;
      break;
  }
  
  // Write to output pins
  digitalWrite(ledPin_1_d, d);
  digitalWrite(ledPin_1_c, c);
  digitalWrite(ledPin_1_b, b);
  digitalWrite(ledPin_1_a, a);
  
}

setup.ino

// Setup
void setup() {

  // isSetupSN74141
  isSetupSN74141();

  // Switch
  pinMode(iRO0, INPUT);

  // Setup RTC
  setupRTC();

}

——

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 #22: Synthesizer – Momentary Button – Mk09

——

#DonLucElectronics #DonLuc #Synthesizer #Mozzi #Keyboard #ADSREnvelope #Arduino #AdafruitMETROM0Express #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Momentary Button

——

Momentary Button

——

Momentary Button

——

Momentary Button – Panel Mount

It’s your basic black or blue action button. This is a very useful, small, panel-mount momentary switch. It is a SPST N.O. with the threaded portion being 6.75 mm in diameter. This button is perfect for basic On/Off functions. Overall length including leads and has small solder lugs for connection. These momentary buttons are rated up to 0.5A and 250VAC.

Momentary button connect two points in a circuit when you press them. Turns on and off a light emitting LED. When the button is open there is no connection between the two legs of the button, so the pin is connected to ground, through the pull-down resistor, and we read a LOW. When the button is closed, it makes a connection between its two legs, connecting the pin to 5 volts, so that we read a HIGH.

You can also wire this circuit the opposite way, with a pullup resistor keeping the input HIGH, and going LOW when the button is pressed. If so, the behavior of the sketch will be reversed, with the LED normally on and turning off when you press the button.

DL2208Mk02

1 x Adafruit METRO M0 Express
8 x Momentary Button – Panel Mount (Blue)
5 x Momentary Button – Panel Mount (Black)
13 x 10K Ohm Resistor
1 x LED Red 5mm
1 x SparkFun Cerberus USB Cable

Adafruit METRO M0 Express

KY0 – 0
KY1 – 1
KY2 – 2
KY3 – 3
KY4 – 4
KY5 – 5
KY6 – 6
KY7 – 7
KY8 – 8
LEDR – 9
KY10 – 10
KY11 – 11
KY12 – 12
KY13 – 13
VIN – +5V
GND – GND

——

DL2208Mk02p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #22: Synthesizer - Momentary Button - Mk09
22-09
DL2208Mk02p.ino
1 x Adafruit METRO M0 Express
8 x Momentary Button - Panel Mount (Blue)
5 x Momentary Button - Panel Mount (Black)
13 x 1K Ohm Resistor
1 x LED Red 5mm
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code


// Simple Keyboard
// Minimum reading of the button that generates a note
//const int iKeyboard0 = 0;
const int iKeyboard1 = 1;
const int iKeyboard2 = 2;
const int iKeyboard3 = 3;
const int iKeyboard4 = 4;
const int iKeyboard5 = 5;
const int iKeyboard6 = 6;
const int iKeyboard7 = 7;
const int iKeyboard8 = 8;
const int iKeyboard10 = 10;
const int iKeyboard11 = 11;
const int iKeyboard12 = 12;
const int iKeyboard13 = 13;
// Button is pressed
int iB0 = 1;
int iB1 = 1;
int iB2 = 1;
int iB3 = 1;
int iB4 = 1;
int iB5 = 1;
int iB6 = 1;
int iB7 = 1;
int iB8 = 1;
int iB10 = 1;
int iB11 = 1;
int iB12 = 1;
int iB13 = 1;

// The number of the LED Red pin 9
const int iLedR =  9;

// Software Version Information
String sver = "22-09";

void loop() {

  // isKeyboard
  isKeyboard();
  
}

getKeyboard.ino

// getKeyboard
// setupKeyboard
void setupKeyboard() {

  // Initialize the button pin as an input
//  pinMode(iKeyboard0, INPUT_PULLUP);
  pinMode(iKeyboard1, INPUT_PULLUP);
  pinMode(iKeyboard2, INPUT_PULLUP);
  pinMode(iKeyboard3, INPUT_PULLUP);
  pinMode(iKeyboard4, INPUT_PULLUP);
  pinMode(iKeyboard5, INPUT_PULLUP);
  pinMode(iKeyboard6, INPUT_PULLUP);
  pinMode(iKeyboard7, INPUT_PULLUP);
  pinMode(iKeyboard8, INPUT_PULLUP);
  pinMode(iKeyboard10, INPUT_PULLUP);
  pinMode(iKeyboard11, INPUT_PULLUP);
  pinMode(iKeyboard12, INPUT_PULLUP);
  pinMode(iKeyboard13, INPUT_PULLUP);
 
}
// isKeyboard
void isKeyboard() {

/*
  // Read the state of the button value 0
  if ( digitalRead(iKeyboard0) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 0
    iB0 = iB0 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB0 = iB0 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }
*/
  // Read the state of the button value 1
  if ( digitalRead(iKeyboard1) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 1
    iB1 = iB1 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB1 = iB1 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 2
  if ( digitalRead(iKeyboard2) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 2
    iB2 = iB2 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB2 = iB2 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 3
  if ( digitalRead(iKeyboard3) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 3
    iB3 = iB3 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB3 = iB3 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 4
  if ( digitalRead(iKeyboard4) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 4
    iB4 = iB4 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB4 = iB4 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 5
  if ( digitalRead(iKeyboard5) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 5
    iB5 = iB5 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB5 = iB5 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 6
  if ( digitalRead(iKeyboard6) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 6
    iB6 = iB6 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB6 = iB6 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 7
  if ( digitalRead(iKeyboard7) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 7
    iB7 = iB7 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB7 = iB7 - 1;// Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 8
  if ( digitalRead(iKeyboard8) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 8
    iB8 = iB8 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB8 = iB8 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 10
  if ( digitalRead(iKeyboard10) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 10
    iB10 = iB10 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB10 = iB10 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 11
  if ( digitalRead(iKeyboard11) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 11
    iB11 = iB11 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB11 = iB11 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 12
  if ( digitalRead(iKeyboard12) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 12
    iB12 = iB12 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB12 = iB12 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

  // Read the state of the button value 13
  if ( digitalRead(iKeyboard13) == HIGH ) {

    // Button is pressed - pullup keeps pin high normally 13
    iB13 = iB13 + 1;
    // Turn LED Red on
    digitalWrite(iLedR, HIGH );

  }
  else
  {
    
    iB13 = iB13 - 1;
    // Turn LED Red off
    digitalWrite(iLedR, LOW );
    
  }

}

setup.ino

// Setup
void setup() {

  // Setup Keyboard
  setupKeyboard();

  // Initialize the LED Red pin 9 as an output
  pinMode(iLedR, OUTPUT);
  
}

——

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

Categories
Archives