smart-home / Mbed 2 deprecated smart-home-final-version

Dependencies:   mbed TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "stdafx.h"
00002 
00003 TextLCD lcd(PTC7,PTC0,PTC3,PTC4,PTC5,PTC6);
00004 AnalogIn temp_sen(A0);
00005 AnalogIn light_sen(A1);
00006 PwmOut pwm(PTE20);
00007 PwmOut led_o(PTB18);
00008 Serial mobile(PTE22, PTE23);
00009 DigitalIn enter(D8);
00010 DigitalIn down(D9);
00011 DigitalIn up(D10);
00012 DigitalIn back(D11);
00013 
00014 
00015 int state = 0;
00016 int type = 0;
00017 int low = 16;
00018 int high = 32;
00019 int bl_vl = 1;
00020 int fanLevel_man = 3;
00021 int lightLevel_man = 2;
00022 int temp_measure;
00023 int fanLevel_dis;
00024 int lightLevel_dis;
00025 int point = 0;
00026 bool modeStatus = true;
00027 
00028 int main()
00029 {
00030     while(1) {
00031         //modeProcess();
00032         if (state == 0) {
00033             mainScreen();
00034             mobile.printf("%i,%i,%i\n",temp_measure,fanLevel_dis,lightLevel_dis);
00035             //mobile.printf("%i",temp_measure);
00036         }
00037         if (state == 1) {
00038             optionScreen();
00039         }
00040         if (state == 2) {
00041             temperatureScreen();
00042         }
00043         if (state == 3) {
00044             lightScreen();
00045         }
00046         if (state == 4) {
00047             fanScreen();
00048         }
00049         if (state == 5) {
00050             modeScreen();
00051         }
00052     }
00053 }
00054