A project that aims at making a LED based light system controlled by microcontroller and with BLE (soon) with smooth color transitions.
main.cpp
- Committer:
- ledonger
- Date:
- 2017-08-18
- Revision:
- 0:b350f8395bff
- Child:
- 1:8b80523d8959
File content as of revision 0:b350f8395bff:
#include "mbed.h" #include "LEDManager.h" PinName pin_array[] = {LED1,D11,D4,D2,D5,D6,D7,D8,D9,D10}; //int pin_array_size = 10/*sizeof(pin_array)/sizeof(PinName)*/; //DigitalOut** io_array; Timer timer; //Serial pc(USBTX,USBRX,921600); //void set_pin_high(); //void set_pin_low(); int main() { //Init //pc.printf("Starting...\n"); //printf("pin_array_size : %d\n",pin_array_size); //io_array = new DigitalOut*[pin_array_size]; /*int i; for(i = 0; i < pin_array_size; i++) { io_array[i] = new DigitalOut(pin_array[i]); } printf("Init : OK\n"); printf("Test procedure\n"); for(i = 0; i < pin_array_size; i++) { *(io_array[i]) = 1; wait(0.1); *(io_array[i]) = 0; wait(0.1); }*/ timer.start(); /*int period_us = 10000; float highTime1 = period_us*0.5;//50% float lowTime1 = (period_us-highTime1); int prevTime = timer.read_us(); int prevUpdateTime = timer.read_us(); int updateTime = 10000; int fadeFactor = 75; int situation1 = 1; int situation2 = 1;*/ LEDManager *led1 = new LEDManager(D11,10000); LEDManager *led2 = new LEDManager(D4,10000); LEDManager *led3 = new LEDManager(D2,10000); LEDManager *led4 = new LEDManager(D5,10000); LEDManager *led5 = new LEDManager(D6,10000); LEDManager *led6 = new LEDManager(D7,10000); LEDManager *led7 = new LEDManager(D8,10000); LEDManager *led8 = new LEDManager(D9,10000); LEDManager *led9 = new LEDManager(D10,10000); //pc.printf("Test : OK\n"); int time = timer.read_us(); while(1) { led1->processLED(time); led2->processLED(time); led3->processLED(time); led4->processLED(time); led5->processLED(time); led6->processLED(time); led7->processLED(time); led8->processLED(time); led9->processLED(time); //printf("%d\n",timer.read_us()-time); time = timer.read_us(); } }