This project will enable remote control of a motorised turntable via a WiFi enabled TCP link using ACKme's (http://ack.me/) Wi-Fi enablement platform
main.cpp
- Committer:
- Stathisn
- Date:
- 2014-08-26
- Revision:
- 0:01fd80c0a524
- Child:
- 1:7b420a2ea7db
File content as of revision 0:01fd80c0a524:
#include "mbed.h" enum calib_state_t { UNCALIBRATED, CALIBRATED, CALIBRATING, INITIALISING,}; DigitalOut my_led(LED1); // Sanity LED DigitalOut ttDrive(PA_14); // the drive signal for the turntable InterruptIn encoder(PA_13); // Signal from encoder InterruptIn limitSwitch(PA_15); // Signal from limit switch calib_state_t calib_state = 0; // Flag for calibration state int encoderMax = 0; // Calibrated maximum value for the encoder void calibrate(void); // synchronises and calibrates MCU to turntable void increment(int *i); // increments value i, used as an interrupt target int main() { // Step 1: Attach interrupt signals to appropriate functions // Step 2: Calibrate MCU to the turn table // Step 3: Control turntable using hard coded commands // Step 4: Include WiConnect Library // Step 5: Interpret commands sent over TCP // Configure sanity LED to blink while(1) { my_led = !my_led; wait(0.5); } } void calibrate(void) { // Step 1: Get the motor turning // Step 2: Continue turning until calibration state is "CALIBRATED" // the actual calibration will be handled by interrupts } void increment(int *i) { // Step 1: De-refference pointer and increment the value }