Skip to content

Instantly share code, notes, and snippets.

@RQF7
Created December 31, 2018 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RQF7/00544d6530f0c39f36679e610abb7a69 to your computer and use it in GitHub Desktop.
Save RQF7/00544d6530f0c39f36679e610abb7a69 to your computer and use it in GitHub Desktop.
/**
* 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