70Views0Replies

Author Options:

c++ code hElp? Answered

this is the code for mobile operated robot found from this site can somebody explain this code
i didnt understand  the line which is Italic and Bold like this (DDRD=0xff;  DDRB=0×00)
somebody plz tell me what the lines are


CODE


/*

DTMF Controlled Robot

PORTD pin 0,1,2,3 goes to motor driver l293d

PORTB pin 0,1,2,3 is connected to output of CM8870 DTMF decoder IC

*/

#include<avr/io.h>

#include<util/delay.h>

int main(void)

{

DDRD=0xff;

DDRB=0×00;


while(1)

{

switch(PINB&0b00001111)

{

case 0b0010://Key 2

{

PORTD=0x0A ;      //1010 both motor front

continue;

}

case 0b0100://Key 4

{

PORTD=0×02;    //0010 right motor front

continue;

}

case 0b0101://Key 5

{

PORTD=0x0F;//1111 SUDDEN STOP

continue;

}

case 0b0110://Key 6

{

PORTD=0×08;  //1000 left motor front

continue;

}

case 0b1000://Key 8

{

PORTD=0×05;

continue;

}

default:

continue;

}

}//end of switch

return 0;

}

//

//

//

//

Tags:ccode

Comments

The forums are retiring in 2021 and are now closed for new topics and comments.