Created
December 31, 2018 07:48
-
-
Save RQF7/00544d6530f0c39f36679e610abb7a69 to your computer and use it in GitHub Desktop.
Motors program for CULET. http://www.comunidad.escom.ipn.mx/ALIROB/CULET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* motor.c | |
* Program for the two drive cubes. | |
* CULET: a Turing machine with Cubelets and Lego. | |
*/ | |
#include "cubelet.h" | |
#define CONTROLLER 85562 | |
#define MOTOR_POWER 80 | |
void setup() | |
{ | |
block_value = 0; | |
} | |
void loop() | |
{ | |
uint8_t intruction = get_block_value(CONTROLLER); | |
switch (intruction) { | |
case 0: | |
set_drive(0); | |
break; | |
case 1: | |
set_drive_direction(FORWARD); | |
set_drive(MOTOR_POWER); | |
break; | |
case 2: | |
set_drive_direction(BACKWARD); | |
set_drive(MOTOR_POWER); | |
break; | |
default: | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment