I use a lot Arduino Uno, but in this case, I have some BQ ZUM BT-328 boards, which are based on Arduino BT. The problem with some of BQ ZUM BT-328 boards is that the ultrasonic sensor (HC-SR04) is not working in any pin. However, apparantely, the boards work and the 2 servos (SM-S4306R) work fine too. When I change the ultrasonic sensor to other pins and with other wires, it is not working yet. However, I use that sensor in another different BQ ZUM BT-328 board and it is working fine, and if I add the same setup (2 SM-S4306R) and same code, it continues working fine. Then, the problem is just in some boards, not in everyone.
The ultrasonic example is:
long distance;
long responseTime;
int pinTrig = 9;
int pinEcho = 8;
void setup(){
Serial.begin(9600);
pinMode(pinTrig, OUTPUT);
pinMode(pinEcho, INPUT);
}
void loop(){
digitalWrite(pinTrig, LOW);
delayMicroseconds(5);
digitalWrite(pinTrig, HIGH);
delayMicroseconds(10);
responseTime = pulseIn(pinEcho, HIGH);
Serial.println("Tiempo "+ String(responseTime)+" microsegundos");
distance = int(0.01716*responseTime);
Serial.println("Distancia "+ String(distance)+"cm");
delay(500);
}
Then, I suppose that those BQ ZUM BT-328 boards have some problem and maybe they are starting to fail. I say this, because the same problem works in some boards and in others fails. In those board in which it fails I checked the correct connection of pins (GND, VCC, digitals), change the pin and the wires without result. However, the servos continue to work fine and I can upload the code to the board. My questions are:
Am I correct and they are failing?
Why they are just failing with that sensor and not the SM-S4306R? I mean, maybe some specific component of the board is failing?