Hi guys
Sorry for delay
I managed to get it working with the potentiometers.
no wantet to attach this to te rev signal of the engine..and after going through one by one one the cluster i found them.
promblem is that the values are stuck at max 1023 and the revs still go higher, how do i manage to fix this?
currently code looks like this, im sure there are ways to simplify this, for me it works for now as a complete newby
.
i have attached a oled to give me readings without needing the pc.
-the ground has one to the arduino and the other to the chassis of the vehicle and has a steady idle reading of 90 to 100 on the screen, once i flip the switch and revs go up it goes over and signal at halfway are already 1023
int LED1 = 2; //pin 2
int LED2 = 3; //pin 3
int LED3 = 4; //pin 4
int LED4 = 5; //pin 5
const int register1 = A0; // input from potentiometer to read value
const int register2 = A1; // input for register value to be read
int registB = 0;
int registA = 0; //initial potentiometer value for serial port
#include "ssd1306.h" //oled library
#include <Adafruit_SSD1306.h> //oled library
#define OLED_RESET 4 //oled library
Adafruit_SSD1306 display(OLED_RESET); //oled library
void setup() {
Serial.begin (9600); //baudrate
pinMode (LED1, OUTPUT); //led 1 out
pinMode (LED2, OUTPUT); // led 2 out
pinMode (LED3, OUTPUT); // led 3 out
pinMode (LED4, OUTPUT); // led 4 out
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
display.display();
// Clear the buffer.
display.clearDisplay();
display.setTextSize(1); //from display begin to display set color is done wor all its work
display.setCursor(0, 0);
display.setTextColor(WHITE);
}
void loop() {
float registA = analogRead(A0);// all this for the oled screen
display.setCursor(0, 0);
display.print("REVS: ");
display.println(registA);
display.display(); //you have to tell the display to...display
delay(50);
display.clearDisplay();
if (registA > 300)display.print ("<< test >>");
registA = analogRead(register1); //assign value from readed value from the port A0
Serial.print("\t Resistance = "); //assign preffix in console serial
Serial.println (registA); //assign what to show, in this case the live feed from A0 refered as to int potevalue begining from 0
if (registA > 200 ) digitalWrite(LED1, HIGH);
if (registA < 200 ) digitalWrite(LED1, LOW);
if (registA > 300 ) digitalWrite(LED2, HIGH);
if (registA < 300 ) digitalWrite(LED2, LOW);
if (registA > 400 ) digitalWrite(LED3, HIGH);
if (registA < 400 ) digitalWrite(LED3, LOW);
if (registA > 500 ) digitalWrite(LED4, HIGH);
if (registA < 500 ) digitalWrite(LED4, LOW);
if (registA > 550 ) digitalWrite(LED1, LOW);
if (registA > 550 ) digitalWrite(LED2, LOW);
if (registA > 550 ) digitalWrite(LED3, LOW);
if (registA > 550 ) digitalWrite(LED4, LOW);
delay (50);
if (registA > 550 ) digitalWrite(LED1, HIGH);
if (registA > 550 ) digitalWrite(LED2, HIGH);
if (registA > 550 ) digitalWrite(LED3, HIGH);
if (registA > 550 ) digitalWrite(LED4, HIGH);
delay (50);
}
thanks guys.
next i will take picture of it wired up