For my school project I am trying to dim a LED with a Bluetooth module. This LED will then be able to dim with your phone.
now I have written a program but it gives a error:
Arduino: 1.6.7 (Windows 8), Board:"Arduino/Genuino Uno"
De schets gebruikt 5.036 bytes (15%) programma-opslagruimte. Maximum is 32.256 bytes.
Globale variabelen gebruiken 220 bytes (10%) van het dynamisch geheugen. Resteren 1.828 bytes voor lokale variabelen. Maximum is 2.048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x8b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x8b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x8b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x8b
avrdude: stk500_recv(): programmer is not responding
Probleem bij het uploaden naar het board. Zie http://www.arduino.cc/en/Guide/Troubleshooting#upload voor suggesties.
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x8b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x8b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x8b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x8b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x8b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x8b
this is the program:
int led = 9; // the pin that the LED is attached to. It is a PWM enabled pin
int brightness; // how bright the LED is
String fadeAmount; // The data got from the device. It is to be in the String format as explained later
// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
digitalWrite(led,LOW);
//Setup Baud rate
Serial.begin(9600);
delay(10);
}
void loop() {
if(Serial.available()>0){
fadeAmount = Serial.readString();
//.toInt() is a macro to convert fadeAmount which is a String to a integer
brightness= fadeAmount.toInt();
Serial.println(brightness);
//brightness=(int)fadeAmount;
//Serial.write((int)brightness);
//Serial.write(brightness);
analogWrite(led,brightness); //to command the 9 pin to glow with the brightness given
// wait for 30 milliseconds to see the dimming effect
//delay(300);
// }
}
}
can someone help me with this problem?
with kind regards
steven
Bluetooth_Fade.ino (981 Bytes)