I have no idea why this has been happening:
byte potenciometro = 0;int redpin=9;
void setup() {
Serial.begin(9600);
}
void loop() {
int valor=analogRead(potenciometro); delay(50);
Serial.println();
Serial.print(valor, DEC);
analogWrite(redpin,valor); }
This code above has been working just fine. However, i understand the LEDs will work properly with intensities that range from 1 to 255, so i replaced this line
Serial.print(valor, DEC);
for this Serial.print((valor/700)*255, DEC);
and all that the IDE has been returning since then is 0 as console output.
i tried also just
Serial.print(valor/700, DEC);
and i get nothing but 0s
anyone?
my arduino is the UNO version.
GNDand5V(I suppose 3.3V)? If you have full scale values (0..1023) it's possible just divide the value by 4 to get result between 0 and 255.