first compiled version

Dependencies:   mbed-rtos mbed C12832_lcd LM75B

Committer:
robertwharrell
Date:
Wed Feb 26 05:34:37 2014 +0000
Revision:
1:83bc9f91d154
Parent:
0:7ae4f23f84a3
Child:
2:43cd60e0e32f
Child:
3:0945093f48ec
Rob is here;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
robertwharrell 1:83bc9f91d154 1 //Rob in the house
robertwharrell 1:83bc9f91d154 2
nleoni 0:7ae4f23f84a3 3 #include "mbed.h"
nleoni 0:7ae4f23f84a3 4 #include "rtos.h"
nleoni 0:7ae4f23f84a3 5
nleoni 0:7ae4f23f84a3 6 AnalogIn pot1(p19);
nleoni 0:7ae4f23f84a3 7 Queue<float,10> potReadingQueue;
nleoni 0:7ae4f23f84a3 8
nleoni 0:7ae4f23f84a3 9 void lcdUpdate(void const*){
nleoni 0:7ae4f23f84a3 10 while(1){
nleoni 0:7ae4f23f84a3 11 osEvent evt = potReadingQueue.get();
nleoni 0:7ae4f23f84a3 12 if (evt.status == osEventMail) {
nleoni 0:7ae4f23f84a3 13 float *queue = (float*)evt.value.p;
nleoni 0:7ae4f23f84a3 14 printf("\nVoltage: %.2f V\n\r" , *queue);
nleoni 0:7ae4f23f84a3 15
nleoni 0:7ae4f23f84a3 16 Thread::wait(1000);
nleoni 0:7ae4f23f84a3 17 }
nleoni 0:7ae4f23f84a3 18 }
nleoni 0:7ae4f23f84a3 19 }
nleoni 0:7ae4f23f84a3 20
nleoni 0:7ae4f23f84a3 21 void readPOT(void const*){
nleoni 0:7ae4f23f84a3 22 while(1){
nleoni 0:7ae4f23f84a3 23 float *queue;
nleoni 0:7ae4f23f84a3 24 *queue = pot1;
nleoni 0:7ae4f23f84a3 25 potReadingQueue.put(queue);
nleoni 0:7ae4f23f84a3 26
nleoni 0:7ae4f23f84a3 27 Thread::wait(10000);
nleoni 0:7ae4f23f84a3 28 }
nleoni 0:7ae4f23f84a3 29
nleoni 0:7ae4f23f84a3 30 }
nleoni 0:7ae4f23f84a3 31
nleoni 0:7ae4f23f84a3 32 void readTemp(void const*){
nleoni 0:7ae4f23f84a3 33
nleoni 0:7ae4f23f84a3 34 }
nleoni 0:7ae4f23f84a3 35
nleoni 0:7ae4f23f84a3 36 void threadCookie(void const*){
nleoni 0:7ae4f23f84a3 37
nleoni 0:7ae4f23f84a3 38 }
nleoni 0:7ae4f23f84a3 39
nleoni 0:7ae4f23f84a3 40 DigitalOut myled(LED1);
nleoni 0:7ae4f23f84a3 41
nleoni 0:7ae4f23f84a3 42 int main() {
nleoni 0:7ae4f23f84a3 43 Thread threadLCD(lcdUpdate);
nleoni 0:7ae4f23f84a3 44 Thread threadPOT(readPOT);
nleoni 0:7ae4f23f84a3 45 Thread threadTemp(readTemp);
nleoni 0:7ae4f23f84a3 46
nleoni 0:7ae4f23f84a3 47 while(1) {
nleoni 0:7ae4f23f84a3 48 }
nleoni 0:7ae4f23f84a3 49 }