Tinkerkit hall sensor Project

Hello, can you please help us with our code? We are using 2 Tinkerkit hall sensors and need to covert the sensor readings to distances (mm). The closer the magnet gets to each sensor a corresponding LED increases its brightness. This is what we’ve done so far. We’ve spent hours at it and can’t figure out why the LEDs aren’t lighting up or a formula for changing the voltages to distance. Any help would be much appreciated.

const int sensorPin1 = A0;
const int sensorPin2 = A1;
const int ledPin1 = 5;
const int ledPin2 = 3;
int sensorVal1 = 0.0;
int sensorVal2 = 0.0;
int LedVal1 = 0;
int LedVal2 = 0;
float voltage1 = 0.0;
float voltage2 = 0.0;
float distance1 = 0.0;
float distance2 = 0.0;
int ledLevel = 0;

void setup() {
// put your setup code here, to run once:
pinMode (sensorPin1, INPUT);
pinMode (sensorPin2, INPUT);
pinMode (ledPin1, OUTPUT);
pinMode (ledPin2, OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
sensorVal1 = analogRead(sensorPin1);
sensorVal2 = analogRead(sensorPin2);
voltage1 = (sensorVal1/1023.0)*5;
voltage2 = (sensorVal2/1023.0)*5;
Serial.print("the sensor value is:");
Serial.print("the sensor value is:");


_2.ino (980 Bytes)

So, you're a student.

Before you posted this, what research did you do about how you should post on the forum?

Before you posted the DUPLICATE of this topic, what research did you do about forum etiquette? (Don't waste your time looking for your duplicate - I deleted it)

I'm sorry I thought there was different forums for sensors and projects so tried to post in both. Didn't mean to offend anyone :confused: