NEED help with a ProMicro project

Hello.. new to all of this and at 50 I wonder why Ive started... easy.. SIM Racing
I have an F1 wheel for my rig.. I have added 3 buttons and 1 rotary encoder.. despite several attempts... I cant get it to work.
Rotary is a Left and Right 360 with a much button centre.
I have 3 momentary buttons. 2 sharing ground and then each with own +
a third is to select Neutral
but for the life of me I just cant get anything to work.

HELP?

The next step is to post a circuit diagram and a full listing of your code. In the Arduino IDE, select all your code, then click the menu Edit | Copy for Forum. Paste that into your message.

on it.

code I took from the Arduino software that I was advised to use.
THEN I took the code from the project I was using as a guide....

I think Im about to get roasted lol

thanks for replying

Darren

new user cant attach.. so I'm stuck

images are here

I will add code in a text document and load asap

#include <Keyboard.h>

int A; //A variable
int B; //B variable
int r = 0; //r variable

void setup() //Initial function. Performed once at the beginning
{
  attachInterrupt(0, STEP, CHANGE); //Contact 2-nd(interrupt0) as an interrupt Pin
  attachInterrupt(1, BUTTON, CHANGE); //Contact 3-rd(int1) as an interrupt Pin
  pinMode(4, INPUT); //Contact 4-th as input
  Serial.begin(9600); //Serial port initialization. Speed 9600
}

void loop() //Main function
{

}

void STEP() //Step function
{
  A = digitalRead(2); //Read value from 2-nd(interrupt0) Pin
  B = digitalRead(4); //Read value from 4-th Pin
  if (A != B) //Compare values
  {
    r++; //Add 1 to the value of the variable 'r'
  } else
  {
    r--; //Subtract 1 from the value of the variable 'r'
  }
  Serial.println(r); //Print 'r' value
}

void BUTTON() //Button function
{
  if (digitalRead(3) == HIGH) //If signal from 3-rd Pin is HIGH
  {
    Serial.println("Button ON"); //Print "Button ON"
  } else if (digitalRead(3) == LOW) //Else if signal from 3-rd Pin is LOW
  {
    Serial.println("Button OFF"); //Print "Button OFF"
  }
}

How to Build a Button Box - YouTube

this was the tutorial I used.

I was trying to check if my BMP280 sensor worked by doing the I2C scanner test which worked and the BMP280 test which did not work. I know my wiring is correct which leads me to believe that the code might be incorrect. However, l got the code from a certain website so l am not 100% sure. If someone could give me code that works or sees what's wrong with the code that would be great. Thanks.

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BMP280.h>

#define BMP_SCK (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS (10)

Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);

void setup() {
Serial.begin(9600);
Serial.println(F("BMP280 test"));

//if (!bmp.begin(BMP280_ADDRESS_ALT, BMP280_CHIPID)) {
if (!bmp.begin()) {
Serial.println(F("Could not find a valid BMP280 sensor, check wiring or try a different address!"));
while (1) delay(10);
}

/* Default settings from datasheet. /
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /
Operating Mode. /
Adafruit_BMP280::SAMPLING_X2, /
Temp. oversampling /
Adafruit_BMP280::SAMPLING_X16, /
Pressure oversampling /
Adafruit_BMP280::FILTER_X16, /
Filtering. /
Adafruit_BMP280::STANDBY_MS_4000); /
Standby time. */
}

void loop() {
Serial.print(F("Temperature = "));
Serial.print(bmp.readTemperature());
Serial.println(" *C");

Serial.print(F("Pressure = "));
Serial.print(bmp.readPressure());
Serial.println(" Pa");

Serial.print(F("Approx altitude = "));
Serial.print(bmp.readAltitude(1013.25)); /* Adjusted to local forecast! */
Serial.println(" m");

Serial.println();
delay(2000);
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.