EMIR - Ekvitermní mikroprocesorová regulace https://code.google.com/p/emir/ https://code.google.com/p/emir/wiki/DesignV3
Dependencies: ConfigFile DS1307 OneWire SDFileSystem USBDeviceLite mbed-rtos mbed
src/main.cpp
- Committer:
- alpov
- Date:
- 2014-05-07
- Revision:
- 4:9065e9ccb078
- Parent:
- 3:ede67e9b60eb
- Child:
- 5:5c8e97742751
File content as of revision 4:9065e9ccb078:
#include "mbed.h" #include "rtos.h" #include "SDFileSystem.h" #include "sensor.h" #include "comm.h" Serial pc(MBED_UARTUSB); SDFileSystem sd(MBED_SPI0, "sd"); DigitalOut ledR(LED_RED, 1); DigitalOut ledG(LED_GREEN, 1); //DigitalOut ledB(LED_BLUE, 1); DigitalOut OUT1(D2, 0); DigitalOut OUT2(D3, 0); DigitalOut OUT3(D4, 0); DigitalOut OUT4(D5, 0); DigitalIn IN1(D8, PullUp); DigitalIn IN2(D9, PullUp); extern "C" void HardFault_Handler() { mbed_die(); } int main(void) { pc.printf("EMIRv2 compiled " __DATE__ " " __TIME__ "\n"); pc.printf("Starting threads... "); Thread sensor(sensor_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); Thread comm(comm_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); pc.printf("done\n"); FILE *fp = fopen("/sd/sdtest2.txt", "w"); if (fp == NULL) { pc.printf("Could not open file for write\n"); } else { pc.printf("Writing... "); fprintf(fp, "Hello fun SD Card World!\nOK!\n"); pc.printf("closing... "); fclose(fp); } pc.printf("done\n"); OUT1 = 1; OUT2 = 1; OUT3 = 1; OUT4 = 1; wait(1.0); OUT1 = 0; OUT2 = 0; OUT3 = 0; OUT4 = 0; while (1) { ledG = !ledG; Thread::wait(200); } }