Hi guys,
When I try to upload this code to my Arduino I get an error. Can you guys help me out?
My code:
#include <SoftwareSerial.h>
SoftwareSerial BLU(0,1);
#define redPin 6
#define greenPin 3
#define bluePin 5
void setup()
{
//Serial setup
Serial.begin(9600);
Serial.println("-= HC-05 Bluetooth RGB LED =-");
BLU.begin(9600);
BLU.println("-= HC-05 Bluetooth RGB LED =-");
pinMode(4, OUTPUT);
digitalWrite(4,HIGH);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
setColor(255, 0, 0);
delay(500);
setColor(0, 255, 0);
delay(500);
setColor(0, 0, 255);
delay(500);
setColor(255, 255, 255);
}
void loop()
{
while (BLU.available() > 0)
{
int redInt = BLU.parseInt();
int greenInt = BLU.parseInt();
int blueInt = BLU.parseInt();
redInt = constrain(redInt, 0, 255);
greenInt = constrain(greenInt, 0, 255);
blueInt = constrain(blueInt, 0, 255);
if (BLU.available() > 0)
{
setColor(redInt, greenInt, blueInt);
Serial.print("Red: ");
Serial.print(redInt);
Serial.print(" Green: ");
Serial.print(greenInt);
Serial.print(" Blue: ");
Serial.print(blueInt);
Serial.println();
BLU.flush();
}
}
}
void setColor(int red, int green, int blue)
{
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}
ERROR:
Arduino:1.8.8 (Windows 10), Board:"Arduino/Genuino Uno"
De schets gebruikt 4680 bytes (14%) programma-opslagruimte. Maximum is 32256 bytes.
Globale variabelen gebruiken 357 bytes (17%) van het dynamisch geheugen. Resteren 1691 bytes voor lokale variabelen. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x75
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x75
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x75
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x75
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x75
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x75
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x75
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x75
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x75
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x75
Probleem bij het uploaden naar het board. Zie http://www.arduino.cc/en/Guide/Troubleshooting#upload voor suggesties.
Dit rapport zou meer informatie bevatten met
"Uitgebreide uitvoer weergeven tijden compilatie"
optie aan in Bestand -> Voorkeuren.