Final Project for 4180 Nixie Tube IoT Clock
Dependencies: 4DGL-uLCD-SE NixieTube MBed_Adafruit-GPS-Library NetServices wave_player mbed spxml
Final Project for ECE 4180
Revision 4:9651e706b36f, committed 2016-12-15
- Comitter:
- fischk08
- Date:
- Thu Dec 15 23:06:56 2016 +0000
- Parent:
- 3:d62bb9ee0aa0
- Commit message:
- Updated for final lab presentation;
Changed in this revision
diff -r d62bb9ee0aa0 -r 9651e706b36f NixieTube.lib --- a/NixieTube.lib Wed Dec 14 08:22:40 2016 +0000 +++ b/NixieTube.lib Thu Dec 15 23:06:56 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/fischk08/code/NixieTube/#0470cc006ce7 +http://developer.mbed.org/users/fischk08/code/NixieTube/#aac4aef5726e
diff -r d62bb9ee0aa0 -r 9651e706b36f main.cpp --- a/main.cpp Wed Dec 14 08:22:40 2016 +0000 +++ b/main.cpp Thu Dec 15 23:06:56 2016 +0000 @@ -31,6 +31,11 @@ wave_player waver(&DACout); // wavplayer object Serial * gps_Serial; // GPS Interface uLCD_4DGL uLCD(p13,p14,p15); // serial tx, serial rx, reset pin; +AnalogIn photocell(p19); +Serial bt(p28, p27); + +// Bluetooth + //LCD Files Needs to be local to the ulcd screen @@ -41,7 +46,7 @@ volatile float lattitude = 33.7490; volatile float longitude = -84.3880; bool gps_setup(); -void display_screen_debug(),request_callback(),parseWeather(),system_setup(),display_weather(int),sound_alarm(int),ethernet_setup(); +void display_screen_debug(),request_callback(),parseWeather(),system_setup(),display_weather(int),sound_alarm(float),ethernet_setup(); // Used for obtaining weather Information void request_callback(HTTPResult r){ @@ -179,23 +184,27 @@ return true; } -void sound_alarm(int volume) { +void sound_alarm() { pressPlay = true; FILE *wave_file = fopen("/local/alarm.wav","r"); - waver.play(wave_file,&pressPlay, &volume); //play(FILE *wavefile,bool *pressPlay, int *volume); + waver.play(wave_file); //play(FILE *wavefile,bool *pressPlay, int *volume); pressPlay = false; + wait(10); fclose(wave_file); } int main() { - //sound_alarm(1); + unsigned char rx; + bt.baud(9600); + char alarm[6] = "02:14"; pc.baud(9600); pc.printf("\r\nintializing hardware,...v15\r\n"); eth.init(); //Use DHCP + int retry = 0; sendGETRequest: EthernetErr ethErr = eth.setup(60000); - int retry = 0; + if (ethErr) { pc.printf("Error in setup trying again %d",retry); retry++; @@ -210,15 +219,43 @@ ntp.setTime(server); char hString[3]; char mString[3]; + char alarmCompare[5]; int offset = 5; int old_min2 = 0; int reset = 0; + char ch; + while(1) { + int x = 0; + if(bt.readable()) + { + //pc.printf("device readable"); + ch=bt.getc(); + //alarm[x] = ch; + pc.printf("%c",ch); + bt.printf("%c",ch); + //x++ + } + + //pc.printf("%f", photocell.read() ); + if (photocell < .3) { + + Ntube.set_dim(0.2); + } else { + Ntube.set_dim(0.5); + } + ctTime = time(NULL) - 3600 * offset; strftime(hString, 3, "%I", localtime(&ctTime)); strftime(mString, 3, "%M", localtime(&ctTime)); - - //pc.printf("hour: %s \n min: %s\n", hString, mString); + + strftime(alarmCompare, 6, "%I:%M", localtime(&ctTime)); + + if (strcmp(alarm, alarmCompare) == 0) { + pc.printf("ALARM\r\n"); + sound_alarm(); + wait(10); + } int hour = std::atoi(hString); int min = std::atoi(mString); @@ -241,8 +278,6 @@ weather(); weather(); } - wait(5); - //ctTime = time(NULL); - //pc.printf("\nTime is now (UTC): %s\n", ctime(&ctTime)); + wait(0.3); } } \ No newline at end of file
diff -r d62bb9ee0aa0 -r 9651e706b36f wave_player.lib --- a/wave_player.lib Wed Dec 14 08:22:40 2016 +0000 +++ b/wave_player.lib Thu Dec 15 23:06:56 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/fischk08/code/wave_player/#5971d559a60a +http://developer.mbed.org/users/sravet/code/wave_player/#acc3e18e77ad