Der RP6 macht dann aber nichts mehr außer Servos ansteuern...Code:#include "RP6RobotBaseLib.h" int main(void) { initRobotBase(); DDRA |= 1; DDRA |= 2; int x; // 10<=x<=20; wenn x >15 in die eine richtung, x<15 in die andre, x=15 stillstand char i; while(true) { x = 15; for(i=0; i<50; i++) { PORTA |= 1; sleep(x); PORTA &= ~1; PORTA |= 2; sleep(30-x); PORTA &= ~2; sleep(170); } x = 10; for(i=0; i<50; i++) { PORTA |= 1; sleep(x); PORTA &= ~1; PORTA |= 2; sleep(30-x); PORTA &= ~2; sleep(170); } x = 20; for(i=0; i<75; i++) { PORTA |= 1; sleep(x); PORTA &= ~1; PORTA |= 2; sleep(30-x); PORTA &= ~2; sleep(170); } } return(0); }
Lesezeichen