Changing port address.

Hi.
I am in the process of building a Balancing robot.
The main code is from Brokking.net - Your Arduino Balancing Robot (YABR) - Downloads.

The code is good for what my needs are with the exception of the Port address.
I have made the changes But I can not be sure that they are correct.
Original code below

Left motor
	PORTD &= 0b11110111;   Currently on D3
	PORTD |= 0b00001000;    Currently on D3
	PORTD |= 0b00000100;    Currently on D2
	PORTD &= 0b11111011;   Currently on D2
	
	
Right motor
	PORTD |= 0b00100000;     Currently on D5
	PORTD &= 0b11011111;    Currently on D5
	PORTD |= 0b00010000;     Currently on D4
	PORTD &= 0b11101111;    Currently on D4

And the changes I have made are.

Left Motor  
       PORTB &=0b11111110   Should be on D8
       PORTB |= 0b00000001   Should be on D8
       PORTD |= 0b01000000   Should be on D6
       PORTD &=0b10111111   Should be on D6


Right motor 
      PORTD |= 0b01111111    Should be on D7
      PORTD &=0b10000000    Should be on D7
      PORTD |= 0b00100000    Should be on D5
      PORTD &=0b11011111    Should be on D5

Have never had to do this before and this took a while to work out with the help of this site.
https://www.peterbeard.co

Not sure that I've formatted this out as it should be.

Regards Antony.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.