#include <tucbot/tucbot.h>
void testMotor(void);
int main(void);
void testMotor(void) {
uint8_t menu_pos = 0;
uint8_t flag_redraw_menu = 0xFF;
int8_t value;
int8_t speed;
int8_t speed_display;
while (1) {
if (flag_redraw_menu) {
flag_redraw_menu = 0x00;
if (menu_pos == 0) {
} else {
}
speed = 0;
speed_display = -128;
}
menu_pos++;
if (menu_pos > 1) {menu_pos = 0;}
flag_redraw_menu = 0xFF;
} else {
if (speed < 100) {
speed+= 5;
if (menu_pos == 0) {
} else {
}
}
} else {
if (speed > 0) {
speed-= 5;
if (menu_pos == 0) {
} else {
}
} else {
}
}
}
if (menu_pos == 0) {
if (speed_display != value) {
speed_display = value;
}
}
}
} else {
if (speed_display != value) {
speed_display = value;
}
}
}
}
}
}
int main (void) {
testMotor();
return (0);
}
void leds_set(eLedMask bitmask, uint8_t bool)
Sets the selected leds on or off.
@ kCurrentGetRight
constants (2): right motor current
Definition: currents.h:45
@ kModeStudent
constant (1): robot is in student mode
Definition: mode.h:31
@ kCurrentGetLeft
constants (1): left motor current
Definition: currents.h:43
@ kMotorSetAll
bit mask (0x03): both motors
Definition: motors.h:47
@ kMotorSetRight
bit mask (0x02): right motor
Definition: motors.h:45
@ kLedOn
constant (0xFF): turn leds on
Definition: leds.h:63
@ kLedRight
bit mask (0x04): right led
Definition: leds.h:46
@ kMotorGetLeft
constant (kMotorSetLeft): left motor
Definition: motors.h:57
uint16_t currents_get(eCurrentGet select)
Returns the last stored current of the selected motor.
int8_t motors_get(eMotorGet select)
Returns the last stored power of the selected motor.
void int16tostr(void *out, int16_t number, uint8_t digits)
Converts an integer to a string and passes it to an output function.
uint8_t currents_changed(void)
Indicates if new data changed the data block sMD_SensCurrent.
@ kRequestContinuous
constant (3): request continuous updates
Definition: update.h:37
@ kLedMiddle
bit mask (0x08): middle led
Definition: leds.h:44
@ kLedOff
constant (0x00): turn leds off
Definition: leds.h:61
uint8_t motors_received(void)
Indicates if new data for the data block sMD_Motor was received.
void lcdclr(void)
Clears the display.
@ kMotorGetRight
constant (kMotorSetRight): right motor
Definition: motors.h:59
void lcdxy(uint8_t x, uint8_t y)
Moves the cursor to a postion on the display.
void mode_set(eMode mode)
Sets the mode of the TUC-Bot.
void motors_request(eRequestType request)
Requests new data from the motors.
void motors_set(eMotorSetMask select, int8_t power)
Sets the motor power of the selected motor(s).
void lcdstr_p(const char *send_data)
Writes a string located in the flash to the display.
@ kMotorSetLeft
bit mask (0x01): left motor
Definition: motors.h:43
void lcdout(uint8_t data)
Writes one byte to the display.
void init_tucbot(uint8_t enable_interrupts)
Initiates the TUC-Bot.
void mdelay(uint16_t mseconds)
Waits for the given time in milliseconds.
void currents_request(eRequestType request)
Requests new data from the motor currents.