O, I am using this code and I am having an error message "Expected unquallified-id on line 28
#include <RedBot.h>
RedBotSensor left = RedBotSensor(A3); // initialize a left sensor object on A3
RedBotSensor center = RedBotSensor(A6); // initialize a center sensor object on A6
RedBotSensor right = RedBotSensor(A7); // initialize a right sensor object on A7
// constants that are used in the code. LINETHRESHOLD is the level to detect
// if the sensor is on the line or not. If the sensor value is greater than this
// the sensor is above a DARK line.
//
// SPEED sets the nominal speed
#define LINETHRESHOLD 800
#define SPEED 60 // sets the nominal speed. Set to any number from 0 - 255.
RedBotMotors motors;
int leftSpeed; // variable used to store the leftMotor speed
int rightSpeed; // variable used to store the rightMotor speed
void setup()
{
Serial.begin(9600);
Serial.println("Welcome to experiment 6.2 - Line Following");
Serial.println("------------------------------------------");
delay(2000);
Serial.println("IR Sensor Readings: ");
delay(500);
}
{ irDetectLeft; VAR; Bit ' Left IR reading;
irDetectRight; VAR; Bit ' Right IR reading;
pulseLeft VAR Word ' pulse values for servos
pulseRight VAR Word
' -----[ Initialization ]----------------------------------------------
DEBUG "Program Running!"
FREQOUT 4, 2000, 3000 ' Signal start/reset.
' -----[ Main Routine ]------------------------------------------------
Main:
' Spin around slowly until an object is spotted
DO
PULSOUT 13, 790 ' Rotate slowly
PULSOUT 12, 790
PAUSE 15 ' 5 ms for detectors
GOSUB Check_IRs ' While looking for object
LOOP UNTIL (irDetectLeft = 0) OR (irDetectRight = 0)
' Now figure out exactly where the object is and go toward it
DO
' Object in both detectors -- go forward
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
pulseLeft = 850 ' Forward
pulseRight = 650
' Object on left - go left
ELSEIF (irDetectLeft = 0) THEN
pulseLeft = 650 ' Left toward object
pulseRight = 650
' Object on right - go right
ELSEIF (irDetectRight = 0) THEN
pulseLeft = 850 ' Right toward object
pulseRight = 850
' No object -- go forward anyway, because the detectors will
ELSE ' momentarily show
pulseLeft = 850 ' "no object" as the
pulseRight = 650 ' Boe-Bot is adjusting
ENDIF ' its position.
PULSOUT 13,pulseLeft ' Apply the pulse.
PULSOUT 12,pulseRight
PAUSE 15 ' 5 ms for detectors
' Check IRs again in case object is moving
GOSUB Check_IRs
LOOP
' -----[ Subroutines ] ------------------------------------------------
Check_IRs:
FREQOUT 8, 1, 38500 ' Check IR Detectors
irDetectLeft = IN9
FREQOUT 2, 1, 38500
IrDetectRight = IN0
}
void loop()
{
}