#include <tucbot/tucbot.h>
void testEncoder(void);
int main(void);
void testEncoder(void) {
uint8_t menu_pos = 0;
uint8_t flag_redraw_menu = 0xFF;
int8_t speed_l = 0, speed_r = 0;
uint8_t bumpers;
while (1) {
if (flag_redraw_menu) {
flag_redraw_menu = 0x00;
switch (menu_pos) {
case 0:
break;
case 1:
break;
default:
menu_pos = 2;
break;
}
}
menu_pos++;
if (menu_pos > 2) {menu_pos = 0;}
flag_redraw_menu = 0xFF;
} else {
}
switch (menu_pos) {
case 0 :
}
break;
case 1 :
}
break;
default:
}
break;
}
}
if (speed_l < -70) {speed_l = -70;}
if (speed_l > 70) {speed_l = 70;}
if (speed_r < -70) {speed_r = -70;}
if (speed_r > 70) {speed_r = 70;}
}
}
int main (void) {
testEncoder();
return (0);
}
void leds_set(eLedMask bitmask, uint8_t bool)
Sets the selected leds on or off.
eEncoderSelectMask encoders_changed(eEncoderSelectMask bitmask)
Indicates if new data changed the selected data blocks.
@ kBumperBackLeft
bit mask (0x04): the back left bumper
Definition: bumpers.h:36
@ kEncoderSelectSpeed
Definition: encoders.h:121
@ kModeStudent
constant (1): robot is in student mode
Definition: mode.h:31
@ 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
@ kEncoderGetSpeedLeft
constant (3): left speed in ticks/s
Definition: encoders.h:185
@ kEncoderSelectAbsAndClear
Definition: encoders.h:159
@ kEncoderGetClearedRight
constant (6): right encoder before it was cleared (16-bit)
Definition: encoders.h:191
@ kEncoderSelectAbs
Definition: encoders.h:118
@ kBumperFrontRight
bit mask (0x02): the front right bumper
Definition: bumpers.h:34
void int16tostr(void *out, int16_t number, uint8_t digits)
Converts an integer to a string and passes it to an output function.
void encoders_clear(void)
Clears the encoder values.
@ kRequestContinuous
constant (3): request continuous updates
Definition: update.h:37
@ kBumperAll
bit mask (0x0F): all bumpers
Definition: bumpers.h:40
@ kLedMiddle
bit mask (0x08): middle led
Definition: leds.h:44
@ kLedOff
constant (0x00): turn leds off
Definition: leds.h:61
@ kEncoderGetSpeedRight
constant (4): right speed in ticks/s
Definition: encoders.h:187
void lcdclr(void)
Clears the display.
void lcdxy(uint8_t x, uint8_t y)
Moves the cursor to a postion on the display.
@ kRequestSingle
constant (1): request a single update
Definition: update.h:33
void bumpers_request(eRequestType request)
Requests new data from the bumpers.
void mode_set(eMode mode)
Sets the mode of the TUC-Bot.
int32_t encoders_get(eEncoderGet select)
Returns the last stored version of the selected value.
@ kEncoderGetRight
constant (2): right encoder (32-bit)
Definition: encoders.h:183
@ kEncoderGetLeft
constant (1): left encoder (32-bit)
Definition: encoders.h:181
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 encoders_request(eEncoderSelectMask bitmask, eRequestType request)
Requests new data from the encoders.
void lcdout(uint8_t data)
Writes one byte to the display.
@ kBumperBackRight
bit mask (0x08): the back right bumper
Definition: bumpers.h:38
void init_tucbot(uint8_t enable_interrupts)
Initiates the TUC-Bot.
void mdelay(uint16_t mseconds)
Waits for the given time in milliseconds.
@ kEncoderGetClearedLeft
constant (5): left encoder before it was cleared (16-bit)
Definition: encoders.h:189
eBumperMask bumpers_get(eBumperMask bitmask)
Returns the last stored value of the masked bumpers.
@ kBumperFrontLeft
bit mask (0x01): the front left bumper
Definition: bumpers.h:32