I am trying to get a motor to turn one turn and when a magnet is sensed on the spindal, the motor will then stop. Repeat.
Sparkfun Pro Micro 5V/16Hz. The sketch has an error when compiling.
--CODE--
//===================== B L O O M ===========================
//A TEST SKETCH FOR SETTING UP A FLIPBOOKIT SMART DUINO
#define SHORT_PAUSE 2000 //a respite after it runs a few times (short_cycle) 1000 = One second
int sensePin_1 = 2; //Hall Effect sense start/end point
int pwm_1 = 6; //motor 1
int i;
void setup()
{
pinMode(pwm_1, OUTPUT);
pinMode(sensePin_1, INPUT);
digitalWrite(sensePin_1, HIGH);
Serial.begin(9600);
}
void loop()
{
OneTurn(pwm_1 ,sensePin_1, 235);
delay (SHORT_PAUSE);
}
void OneTurn(int channel_a, int check, int chA_pwr)
{
for (i=8; i>1; iā)
{
analogWrite(channel_a, chA_pwr);
delay(40);
analogWrite(channel_a, 0);
delay(100);
digitalRead(check);
}
while (digitalRead(check) == 1)
{
digitalRead(check);
analogWrite(channel_a, chA_pwr);
delay(40);
analogWrite(channel_a, 0);
delay(100);
digitalRead(check);
}
}
--CODE END--
--ERROR--
sketch_aug25a:21: error: stray '' in program
sketch_aug25a.ino: In function 'void OneTurn(int, int, int)':
sketch_aug25a:21: error: expected )' before 'u2013' sketch_aug25a:21: error: 'u2013' was not declared in this scope sketch_aug25a:21: error: expected
;' before ')' token
--ERROR END--
I would appreciate if someone has an answer to this. I would think it something pretty basic.
Rich