Hello, this topic may seem generic but im having issue with my UNO R3 board.
I have a script that basically changes the color of my led strip depending on the distance measured by a ultrasonic sensor. It was working few weeks ago but now the led isn't lighting up at all and the ultrasonic sensor is returning 0.0cm always.
I believe it to be a hardware/circuit or maybe short circuit issue since I heard some sort of cracking sound while I was doing some wiring. No wire pins is broken or left inside the Arduino board though.
I tested further with a simple script to read the values of pin 2 (digital pin) and it reads value of 1 when nothing is connected to it.
The RX TX is responding normally to my interval set for ultrasonic reading.
I have plans to test with another uno board but is there other tests I can do to determine if the board is fried? Any guidance is appreciated.
This is the code i used for led color change to ultrasonic value
#include <Adafruit_NeoPixel.h>
//#define balls 8
//#define NUMPIXELSBALLZ 16
#define strip 8
#define NUMPIXELSSTRIP 8
//Adafruit_NeoPixel BALLZ = Adafruit_NeoPixel(NUMPIXELSBALLZ, balls, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel STRIPPED = Adafruit_NeoPixel(NUMPIXELSSTRIP, strip, NEO_GRB + NEO_KHZ800);
// other pins
const int USpower = 11;
const int trigPin = 12;
const int echoPin = 13;
//rgb 0/255/139 cyan
int red, green;
int cccc = 0;
float truered, truegreen;
//uint32_t colors[NUMPIXELSBALLZ];
uint32_t colornya = STRIPPED.Color(0,0,0);
int v1,v2,v3,v4,v5;
int n1,n2,n3,n4,n5;
void setup() {
pinMode(USpower,OUTPUT);
pinMode(trigPin, OUTPUT);
pinMode(echoPin,INPUT);
Serial.begin(9600);
//BALLZ.begin();
STRIPPED.begin();
}
void loop() {
digitalWrite(USpower,HIGH);
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
long duration = pulseIn(echoPin,HIGH);
float distance = duration*0.034 / 2;
int measure = (int)distance;
cccc = cccc + 1;
Serial.print("distance: ");
Serial.print(distance, 1);
Serial.print("cm nya: ");
Serial.println(cccc);
if (measure <= 5) {
colornya = STRIPPED.Color(255,0,0);
} else if (measure > 5 && measure <= 32) {
red = 255 - (distance * 10);
green = distance * 10;
red = constrain(red, 0 ,255);
green = constrain(green, 0 ,255);
truered = (int)red;
truegreen = (int)green;
colornya = STRIPPED.Color(truered, truegreen, 0);
} else if (measure > 32) {
colornya = STRIPPED.Color(0,255,255);
}
for (int i = 0; i < NUMPIXELSSTRIP; i++) {
STRIPPED.setPixelColor(i, colornya);
}
STRIPPED.setBrightness(39);
STRIPPED.show();
delay(100);
}
Physical connections:
Ultrasonic:
Vcc to 5V
Trig to pin 12
Echo to pin 13
Ground to GND




