EasyManua.ls Logo

Keyestudio 4WD Bluetooth Multi-functional Car - Page 80

Keyestudio 4WD Bluetooth Multi-functional Car
151 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
keyestudio
www.keyestudio.com
78
unsigned char old_SL,old_SM,old_SR;
void loop()
{
Sensor_Scan();
if (SM == HIGH)// middle sensor in black area
{
if (SL == LOW & SR == HIGH) // black on left, white on right, turn left
{
turnR();
}
else if (SR == LOW & SL == HIGH) // white on left, black on right, turn right
{
turnL();
}
else // white on both sides, going forward
{
advance();
}
}
else // middle sensor on white area
{
if (SL== LOW & SR == HIGH)// black on left, white on right, turn left
{
turnR();
}
else if (SR == LOW & SL == HIGH) // white on left, black on right, turn right

Related product manuals