I was playing around with my Arduino Uno R3 board with Sublime Text 2 & 'Stino' as IDE
I am not sure if it is my code is the problem or if I broke something...
I pressed upload while another sketch didn't finish uploading, even the original Arduino IDE can't upload new sketches anymore!
This is my code:
// singleServo.ino
#include <Servo.h>
Servo servo;
const int button = 2;
const int led = 13;
const int buzzerPin = 10;
const int duration = 180;
int stateLED = LOW;
int previous = LOW;
void setup() {
pinMode(led, OUTPUT);
pinMode(button, INPUT);
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int stateButton;
stateButton = digitalRead(button);
if (stateButton == LOW && previous == LOW) {
if (stateLED == HIGH)
{
stateLED = LOW;
initAction(duration);
}
else
{
stateLED = HIGH;
}
}
digitalWrite(led, stateLED);
previous = stateButton;
servo.detach();
}
void initAction(int time_iA){
tone(buzzerPin, 523, 200);
delay(200);
shiftServo(180, time_iA);
tone(buzzerPin, 262, 200);
}
void shiftServo(int angle, int time_sS) {
servo.attach(9);
delay(500);
int position;
for(position=0; position <= angle; position += 1)
{
servo.write(position);
delay(time_sS / 180);
Serial.println(servo.read());
}
// for(position=angle; position >= 0; position -= 1)
// {
// servo.write(position);
// delay(time_sS / 90);
// }
}
I am a newbie with all things Arduino - Please help!
EDIT:
After rebooting the system (Ubuntu Linux 14.04) everything was working just fine again!
But I'm going to take the serial functions out too.