![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
FINAL PROJECT isn't it
Fork of ELEC351 by
main.cpp@31:4a88bf97b53e, 2018-01-06 (annotated)
- Committer:
- thomasmorris
- Date:
- Sat Jan 06 23:04:05 2018 +0000
- Revision:
- 31:4a88bf97b53e
- Parent:
- 30:4cde05cc7c4f
- Child:
- 32:8f2795716e97
Working LCD set time
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 6:97f586597310 | 1 | /* |
thomasmorris | 6:97f586597310 | 2 | ELEC 351 Group T |
thomasmorris | 6:97f586597310 | 3 | Team Members : Christopher Hills, Thomas Morris |
thomasmorris | 31:4a88bf97b53e | 4 | Current Verision 14 |
thomasmorris | 29:64b1f95a807c | 5 | Overiew: Working Tasks 1,2,4,5,6,7,8,10,11,12,13 |
thomasmorris | 8:0e4481b64353 | 6 | |
thomasmorris | 12:536eca338ae8 | 7 | Last Revision: Added Mail Box to serial |
thomasmorris | 8:0e4481b64353 | 8 | Todo: |
thomasmorris | 12:536eca338ae8 | 9 | make a mailbox within SD card, LCD, network so they can be used from within |
thomasmorris | 12:536eca338ae8 | 10 | Fix the network so it uses the mail box data. |
thomasmorris | 6:97f586597310 | 11 | */ |
thomasmorris | 6:97f586597310 | 12 | |
thomasmorris | 25:36699ed589ab | 13 | #include "SETUP.hpp" |
chills | 24:7d2da96e05ad | 14 | |
thomasmorris | 29:64b1f95a807c | 15 | void Network()//Interrupt service routine for handling the timeout |
thomasmorris | 8:0e4481b64353 | 16 | { |
thomasmorris | 29:64b1f95a807c | 17 | osEvent evt_network = mail_box.get(); //Get the latest entry from "mail_box" |
thomasmorris | 25:36699ed589ab | 18 | |
thomasmorris | 25:36699ed589ab | 19 | if (evt_network.status == osEventMail) { |
chills | 17:37d883f40c3d | 20 | DATA *Rec_Data_Network = (DATA*)evt_network.value.p; //Create pointer to mailbox |
chills | 17:37d883f40c3d | 21 | DATA msg_network; //Create temporary instance of DATA class |
thomasmorris | 25:36699ed589ab | 22 | |
chills | 17:37d883f40c3d | 23 | msg_network.set_time(Rec_Data_Network->get_time()); //Copy time from mailbox to temporary instance |
chills | 17:37d883f40c3d | 24 | msg_network.set_temperature(Rec_Data_Network->get_temperature()); //Copy temperature from mailbox to temporary instance |
chills | 17:37d883f40c3d | 25 | msg_network.set_pressure(Rec_Data_Network->get_pressure()); //Copy pressure from mailbox to temporary instance |
thomasmorris | 25:36699ed589ab | 26 | msg_network.set_light(Rec_Data_Network->get_light()); //Copy light from mailbox to temporary instance |
chills | 17:37d883f40c3d | 27 | mail_box.free(Rec_Data_Network); //Free space in the mailbox (delete earliest sample taken) |
thomasmorris | 25:36699ed589ab | 28 | |
chills | 24:7d2da96e05ad | 29 | networktest(); |
thomasmorris | 25:36699ed589ab | 30 | } |
chills | 13:db857b3744c6 | 31 | } |
thomasmorris | 31:4a88bf97b53e | 32 | void LCD_Write_Year() |
thomasmorris | 12:536eca338ae8 | 33 | { |
thomasmorris | 31:4a88bf97b53e | 34 | int Years = LCD_Time_Get("Years"); |
thomasmorris | 31:4a88bf97b53e | 35 | stringstream ss; |
thomasmorris | 31:4a88bf97b53e | 36 | ss << Years; |
thomasmorris | 31:4a88bf97b53e | 37 | string Year_String = ss.str(); |
thomasmorris | 31:4a88bf97b53e | 38 | LCD.DDRAM_Address(0x00); |
thomasmorris | 31:4a88bf97b53e | 39 | LCD.Write_String("Set Year"); |
thomasmorris | 31:4a88bf97b53e | 40 | LCD.DDRAM_Address(0x40); |
thomasmorris | 31:4a88bf97b53e | 41 | LCD.Write_String(Year_String); |
thomasmorris | 30:4cde05cc7c4f | 42 | } |
thomasmorris | 25:36699ed589ab | 43 | |
thomasmorris | 31:4a88bf97b53e | 44 | void LCD_Write_Month() |
thomasmorris | 31:4a88bf97b53e | 45 | { |
thomasmorris | 31:4a88bf97b53e | 46 | int Months = LCD_Time_Get("Months"); |
thomasmorris | 31:4a88bf97b53e | 47 | stringstream ss; |
thomasmorris | 31:4a88bf97b53e | 48 | ss << Months; |
thomasmorris | 31:4a88bf97b53e | 49 | string Month_String = ss.str(); |
thomasmorris | 31:4a88bf97b53e | 50 | LCD.DDRAM_Address(0x00); |
thomasmorris | 31:4a88bf97b53e | 51 | LCD.Write_String("Set Month"); |
thomasmorris | 31:4a88bf97b53e | 52 | LCD.DDRAM_Address(0x40); |
thomasmorris | 31:4a88bf97b53e | 53 | LCD.Write_String(Month_String); |
thomasmorris | 31:4a88bf97b53e | 54 | } |
thomasmorris | 31:4a88bf97b53e | 55 | void LCD_Write_Day() |
thomasmorris | 31:4a88bf97b53e | 56 | { |
thomasmorris | 31:4a88bf97b53e | 57 | int Days = LCD_Time_Get("Days"); |
thomasmorris | 31:4a88bf97b53e | 58 | stringstream ss; |
thomasmorris | 31:4a88bf97b53e | 59 | ss << Days; |
thomasmorris | 31:4a88bf97b53e | 60 | string Day_String = ss.str(); |
thomasmorris | 31:4a88bf97b53e | 61 | LCD.DDRAM_Address(0x00); |
thomasmorris | 31:4a88bf97b53e | 62 | LCD.Write_String("Set Day"); |
thomasmorris | 31:4a88bf97b53e | 63 | LCD.DDRAM_Address(0x40); |
thomasmorris | 31:4a88bf97b53e | 64 | LCD.Write_String(Day_String); |
thomasmorris | 31:4a88bf97b53e | 65 | } |
thomasmorris | 31:4a88bf97b53e | 66 | |
thomasmorris | 31:4a88bf97b53e | 67 | |
thomasmorris | 31:4a88bf97b53e | 68 | void LCD_Write_Hour() |
thomasmorris | 30:4cde05cc7c4f | 69 | { |
thomasmorris | 31:4a88bf97b53e | 70 | int Hours = LCD_Time_Get("Hours"); |
thomasmorris | 31:4a88bf97b53e | 71 | stringstream ss; |
thomasmorris | 31:4a88bf97b53e | 72 | ss << Hours; |
thomasmorris | 31:4a88bf97b53e | 73 | string Hour_String = ss.str(); |
thomasmorris | 31:4a88bf97b53e | 74 | LCD.DDRAM_Address(0x00); |
thomasmorris | 31:4a88bf97b53e | 75 | LCD.Write_String("Set Hour"); |
thomasmorris | 31:4a88bf97b53e | 76 | LCD.DDRAM_Address(0x40); |
thomasmorris | 31:4a88bf97b53e | 77 | LCD.Write_String(Hour_String); |
thomasmorris | 31:4a88bf97b53e | 78 | } |
thomasmorris | 31:4a88bf97b53e | 79 | void LCD_Write_Minute() |
thomasmorris | 31:4a88bf97b53e | 80 | { |
thomasmorris | 31:4a88bf97b53e | 81 | int Minutes = LCD_Time_Get("Minutes"); |
thomasmorris | 31:4a88bf97b53e | 82 | stringstream ss; |
thomasmorris | 31:4a88bf97b53e | 83 | ss << Minutes; |
thomasmorris | 31:4a88bf97b53e | 84 | string Minute_String = ss.str(); |
thomasmorris | 31:4a88bf97b53e | 85 | LCD.DDRAM_Address(0x00); |
thomasmorris | 31:4a88bf97b53e | 86 | LCD.Write_String("Set Minute"); |
thomasmorris | 31:4a88bf97b53e | 87 | LCD.DDRAM_Address(0x40); |
thomasmorris | 31:4a88bf97b53e | 88 | LCD.Write_String(Minute_String); |
thomasmorris | 31:4a88bf97b53e | 89 | } |
thomasmorris | 31:4a88bf97b53e | 90 | void LCD_Write_Seconds() |
thomasmorris | 31:4a88bf97b53e | 91 | { |
thomasmorris | 31:4a88bf97b53e | 92 | int Seconds = LCD_Time_Get("Seconds"); |
thomasmorris | 31:4a88bf97b53e | 93 | stringstream ss; |
thomasmorris | 31:4a88bf97b53e | 94 | ss << Seconds; |
thomasmorris | 31:4a88bf97b53e | 95 | string Second_String = ss.str(); |
thomasmorris | 31:4a88bf97b53e | 96 | LCD.DDRAM_Address(0x00); |
thomasmorris | 31:4a88bf97b53e | 97 | LCD.Write_String("Set Second"); |
thomasmorris | 31:4a88bf97b53e | 98 | LCD.DDRAM_Address(0x40); |
thomasmorris | 31:4a88bf97b53e | 99 | LCD.Write_String(Second_String); |
thomasmorris | 7:dfe19413fdc2 | 100 | } |
thomasmorris | 30:4cde05cc7c4f | 101 | |
thomasmorris | 30:4cde05cc7c4f | 102 | void LCD_Output() |
thomasmorris | 30:4cde05cc7c4f | 103 | { |
thomasmorris | 30:4cde05cc7c4f | 104 | while(1) |
thomasmorris | 29:64b1f95a807c | 105 | { |
thomasmorris | 30:4cde05cc7c4f | 106 | Thread::wait(10);//Dont Delete |
chills | 13:db857b3744c6 | 107 | osEvent evt_lcd = mail_box.get(); //Get the latest entry from "mail_box" |
thomasmorris | 31:4a88bf97b53e | 108 | DATA msg_lcd; //Create temporary instance of DATA class |
thomasmorris | 30:4cde05cc7c4f | 109 | if (evt_lcd.status == osEventMail) |
thomasmorris | 30:4cde05cc7c4f | 110 | { |
chills | 17:37d883f40c3d | 111 | DATA *Rec_Data_LCD = (DATA*)evt_lcd.value.p; //Create pointer to mailbox |
thomasmorris | 25:36699ed589ab | 112 | |
chills | 17:37d883f40c3d | 113 | msg_lcd.set_time(Rec_Data_LCD->get_time()); //Copy time from mailbox to temporary instance |
chills | 17:37d883f40c3d | 114 | msg_lcd.set_temperature(Rec_Data_LCD->get_temperature()); //Copy temperature from mailbox to temporary instance |
chills | 17:37d883f40c3d | 115 | msg_lcd.set_pressure(Rec_Data_LCD->get_pressure()); //Copy pressure from mailbox to temporary instance |
chills | 17:37d883f40c3d | 116 | msg_lcd.set_light(Rec_Data_LCD->get_light()); //Copy light from mailbox to temporary instance |
chills | 17:37d883f40c3d | 117 | mail_box.free(Rec_Data_LCD); //Free space in the mailbox (delete earliest sample taken) |
thomasmorris | 30:4cde05cc7c4f | 118 | } |
thomasmorris | 30:4cde05cc7c4f | 119 | if(mode == 0)//Default mode |
thomasmorris | 30:4cde05cc7c4f | 120 | { |
thomasmorris | 30:4cde05cc7c4f | 121 | cout << "In mode 0" << endl; |
thomasmorris | 30:4cde05cc7c4f | 122 | Thread::wait(3000); |
thomasmorris | 30:4cde05cc7c4f | 123 | |
thomasmorris | 30:4cde05cc7c4f | 124 | sprintf (LCD_buffer, "%1.1f %1.1f %1.1f",msg_lcd.get_temperature(),msg_lcd.get_pressure(),msg_lcd.get_light());//Used for converting to a sting |
thomasmorris | 30:4cde05cc7c4f | 125 | LCD.DDRAM_Address(0x00); |
thomasmorris | 30:4cde05cc7c4f | 126 | LCD.Write_String("Temp Pres li"); |
thomasmorris | 30:4cde05cc7c4f | 127 | LCD.DDRAM_Address(0x40); |
thomasmorris | 30:4cde05cc7c4f | 128 | LCD.Write_String(LCD_buffer); |
thomasmorris | 25:36699ed589ab | 129 | |
thomasmorris | 30:4cde05cc7c4f | 130 | Thread::wait(3000); |
thomasmorris | 30:4cde05cc7c4f | 131 | |
thomasmorris | 30:4cde05cc7c4f | 132 | time_t msel_time = msg_lcd.get_time(); //Declare local variable for time |
thomasmorris | 30:4cde05cc7c4f | 133 | strftime(scom_time_buffer, 32, "%I:%M %p", localtime(&msel_time)); //Format time as a string |
thomasmorris | 30:4cde05cc7c4f | 134 | LCD.Display_Clear(); |
thomasmorris | 31:4a88bf97b53e | 135 | sprintf (LCD_buffer, "%d:%d %d,%d",LCD_Time_Get("Hours"),LCD_Time_Get("Minutes"),LCD_Time_Get("Months"),LCD_Time_Get("Years"));//Used for converting to a sting |
thomasmorris | 30:4cde05cc7c4f | 136 | LCD.DDRAM_Address(0x00); |
thomasmorris | 30:4cde05cc7c4f | 137 | LCD.Write_String("Current Time:"); |
thomasmorris | 30:4cde05cc7c4f | 138 | LCD.DDRAM_Address(0x40); |
thomasmorris | 30:4cde05cc7c4f | 139 | LCD.Write_String(LCD_buffer); |
thomasmorris | 31:4a88bf97b53e | 140 | |
thomasmorris | 31:4a88bf97b53e | 141 | if(SW1.read() & SW2.read() == 1) |
thomasmorris | 31:4a88bf97b53e | 142 | { |
thomasmorris | 31:4a88bf97b53e | 143 | mode = 1; |
thomasmorris | 31:4a88bf97b53e | 144 | } |
thomasmorris | 30:4cde05cc7c4f | 145 | } |
thomasmorris | 30:4cde05cc7c4f | 146 | else if(mode == 1)//Choose either date setting or time setting |
thomasmorris | 30:4cde05cc7c4f | 147 | { |
thomasmorris | 30:4cde05cc7c4f | 148 | cout << "In Mode 1" << endl; |
thomasmorris | 30:4cde05cc7c4f | 149 | LCD.Display_Clear(); |
thomasmorris | 31:4a88bf97b53e | 150 | while(1) |
thomasmorris | 31:4a88bf97b53e | 151 | { |
thomasmorris | 31:4a88bf97b53e | 152 | LCD.DDRAM_Address(0x00); |
thomasmorris | 31:4a88bf97b53e | 153 | LCD.Write_String("Date Time"); |
thomasmorris | 31:4a88bf97b53e | 154 | LCD.DDRAM_Address(0x40); |
thomasmorris | 31:4a88bf97b53e | 155 | LCD.Write_String("< >"); |
thomasmorris | 31:4a88bf97b53e | 156 | Thread::wait(1000); |
thomasmorris | 31:4a88bf97b53e | 157 | if(SW1.read() == 1) |
thomasmorris | 31:4a88bf97b53e | 158 | { |
thomasmorris | 31:4a88bf97b53e | 159 | mode = 2; |
thomasmorris | 31:4a88bf97b53e | 160 | break; |
thomasmorris | 31:4a88bf97b53e | 161 | } |
thomasmorris | 31:4a88bf97b53e | 162 | if(SW2.read() == 1) |
thomasmorris | 31:4a88bf97b53e | 163 | { |
thomasmorris | 31:4a88bf97b53e | 164 | mode = 5; |
thomasmorris | 31:4a88bf97b53e | 165 | break; |
thomasmorris | 31:4a88bf97b53e | 166 | } |
thomasmorris | 31:4a88bf97b53e | 167 | } |
thomasmorris | 30:4cde05cc7c4f | 168 | } |
thomasmorris | 30:4cde05cc7c4f | 169 | else if(mode == 2)//Set the Year |
thomasmorris | 30:4cde05cc7c4f | 170 | { |
thomasmorris | 30:4cde05cc7c4f | 171 | cout << "In Mode 2" << endl; |
thomasmorris | 31:4a88bf97b53e | 172 | LCD.Display_Clear(); |
thomasmorris | 31:4a88bf97b53e | 173 | while(1) |
thomasmorris | 31:4a88bf97b53e | 174 | { |
thomasmorris | 31:4a88bf97b53e | 175 | Thread::wait(1000); |
thomasmorris | 31:4a88bf97b53e | 176 | LCD_Write_Year(); |
thomasmorris | 31:4a88bf97b53e | 177 | |
thomasmorris | 31:4a88bf97b53e | 178 | if(SW1.read() == 1 & SW2.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 179 | { |
thomasmorris | 31:4a88bf97b53e | 180 | Add_Year(); |
thomasmorris | 31:4a88bf97b53e | 181 | } |
thomasmorris | 31:4a88bf97b53e | 182 | else if(SW2.read() == 1 & SW1.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 183 | { |
thomasmorris | 31:4a88bf97b53e | 184 | Subtract_Year(); |
thomasmorris | 31:4a88bf97b53e | 185 | } |
thomasmorris | 31:4a88bf97b53e | 186 | LCD_Write_Year(); |
thomasmorris | 31:4a88bf97b53e | 187 | |
thomasmorris | 31:4a88bf97b53e | 188 | if(SW1.read() & SW2.read() == 1) |
thomasmorris | 31:4a88bf97b53e | 189 | { |
thomasmorris | 31:4a88bf97b53e | 190 | mode = 3; |
thomasmorris | 31:4a88bf97b53e | 191 | break; |
thomasmorris | 31:4a88bf97b53e | 192 | } |
thomasmorris | 31:4a88bf97b53e | 193 | } |
thomasmorris | 30:4cde05cc7c4f | 194 | } |
thomasmorris | 30:4cde05cc7c4f | 195 | else if(mode == 3)//Set the Month |
thomasmorris | 30:4cde05cc7c4f | 196 | { |
thomasmorris | 30:4cde05cc7c4f | 197 | cout << "In Mode 3" << endl; |
thomasmorris | 31:4a88bf97b53e | 198 | LCD.Display_Clear(); |
thomasmorris | 31:4a88bf97b53e | 199 | while(1) |
thomasmorris | 31:4a88bf97b53e | 200 | { |
thomasmorris | 31:4a88bf97b53e | 201 | |
thomasmorris | 31:4a88bf97b53e | 202 | Thread::wait(1000); |
thomasmorris | 31:4a88bf97b53e | 203 | |
thomasmorris | 31:4a88bf97b53e | 204 | if(SW1.read() == 1 & SW2.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 205 | { |
thomasmorris | 31:4a88bf97b53e | 206 | Add_Month(); |
thomasmorris | 31:4a88bf97b53e | 207 | } |
thomasmorris | 31:4a88bf97b53e | 208 | else if(SW2.read() == 1 & SW1.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 209 | { |
thomasmorris | 31:4a88bf97b53e | 210 | Subtract_Month(); |
thomasmorris | 31:4a88bf97b53e | 211 | } |
thomasmorris | 31:4a88bf97b53e | 212 | LCD_Write_Month(); |
thomasmorris | 31:4a88bf97b53e | 213 | |
thomasmorris | 31:4a88bf97b53e | 214 | if(SW1.read() & SW2.read() == 1) |
thomasmorris | 31:4a88bf97b53e | 215 | { |
thomasmorris | 31:4a88bf97b53e | 216 | mode = 4; |
thomasmorris | 31:4a88bf97b53e | 217 | break; |
thomasmorris | 31:4a88bf97b53e | 218 | } |
thomasmorris | 31:4a88bf97b53e | 219 | } |
thomasmorris | 30:4cde05cc7c4f | 220 | } |
thomasmorris | 30:4cde05cc7c4f | 221 | else if(mode == 4)//Set the Day |
thomasmorris | 30:4cde05cc7c4f | 222 | { |
thomasmorris | 30:4cde05cc7c4f | 223 | cout << "In Mode 4" << endl; |
thomasmorris | 31:4a88bf97b53e | 224 | LCD.Display_Clear(); |
thomasmorris | 31:4a88bf97b53e | 225 | while(1) |
thomasmorris | 31:4a88bf97b53e | 226 | { |
thomasmorris | 31:4a88bf97b53e | 227 | Thread::wait(1000); |
thomasmorris | 31:4a88bf97b53e | 228 | |
thomasmorris | 31:4a88bf97b53e | 229 | if(SW1.read() == 1 & SW2.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 230 | { |
thomasmorris | 31:4a88bf97b53e | 231 | Add_Day(); |
thomasmorris | 31:4a88bf97b53e | 232 | } |
thomasmorris | 31:4a88bf97b53e | 233 | else if(SW2.read() == 1 & SW1.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 234 | { |
thomasmorris | 31:4a88bf97b53e | 235 | Subtract_Day(); |
thomasmorris | 31:4a88bf97b53e | 236 | } |
thomasmorris | 31:4a88bf97b53e | 237 | LCD_Write_Day(); |
thomasmorris | 31:4a88bf97b53e | 238 | |
thomasmorris | 31:4a88bf97b53e | 239 | if(SW1.read() & SW2.read() == 1) |
thomasmorris | 31:4a88bf97b53e | 240 | { |
thomasmorris | 31:4a88bf97b53e | 241 | mode = 0; |
thomasmorris | 31:4a88bf97b53e | 242 | break; |
thomasmorris | 31:4a88bf97b53e | 243 | } |
thomasmorris | 31:4a88bf97b53e | 244 | } |
thomasmorris | 30:4cde05cc7c4f | 245 | } |
thomasmorris | 30:4cde05cc7c4f | 246 | else if(mode == 5)//Set the Hour |
thomasmorris | 30:4cde05cc7c4f | 247 | { |
thomasmorris | 30:4cde05cc7c4f | 248 | cout << "In Mode 5" << endl; |
thomasmorris | 31:4a88bf97b53e | 249 | LCD.Display_Clear(); |
thomasmorris | 31:4a88bf97b53e | 250 | while(1) |
thomasmorris | 31:4a88bf97b53e | 251 | { |
thomasmorris | 31:4a88bf97b53e | 252 | Thread::wait(1000); |
thomasmorris | 31:4a88bf97b53e | 253 | |
thomasmorris | 31:4a88bf97b53e | 254 | if(SW1.read() == 1 & SW2.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 255 | { |
thomasmorris | 31:4a88bf97b53e | 256 | Add_Hour(); |
thomasmorris | 31:4a88bf97b53e | 257 | } |
thomasmorris | 31:4a88bf97b53e | 258 | else if(SW2.read() == 1 & SW1.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 259 | { |
thomasmorris | 31:4a88bf97b53e | 260 | Subtract_Hour(); |
thomasmorris | 31:4a88bf97b53e | 261 | } |
thomasmorris | 31:4a88bf97b53e | 262 | LCD_Write_Hour(); |
thomasmorris | 31:4a88bf97b53e | 263 | |
thomasmorris | 31:4a88bf97b53e | 264 | if(SW1.read() & SW2.read() == 1) |
thomasmorris | 31:4a88bf97b53e | 265 | { |
thomasmorris | 31:4a88bf97b53e | 266 | mode = 6; |
thomasmorris | 31:4a88bf97b53e | 267 | break; |
thomasmorris | 31:4a88bf97b53e | 268 | } |
thomasmorris | 31:4a88bf97b53e | 269 | } |
thomasmorris | 30:4cde05cc7c4f | 270 | } |
thomasmorris | 30:4cde05cc7c4f | 271 | else if(mode == 6)//Set the Minute |
thomasmorris | 30:4cde05cc7c4f | 272 | { |
thomasmorris | 30:4cde05cc7c4f | 273 | cout << "In Mode 6" << endl; |
thomasmorris | 31:4a88bf97b53e | 274 | LCD.Display_Clear(); |
thomasmorris | 31:4a88bf97b53e | 275 | while(1) |
thomasmorris | 31:4a88bf97b53e | 276 | { |
thomasmorris | 31:4a88bf97b53e | 277 | Thread::wait(1000); |
thomasmorris | 31:4a88bf97b53e | 278 | |
thomasmorris | 31:4a88bf97b53e | 279 | if(SW1.read() == 1 & SW2.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 280 | { |
thomasmorris | 31:4a88bf97b53e | 281 | Add_Minute(); |
thomasmorris | 31:4a88bf97b53e | 282 | } |
thomasmorris | 31:4a88bf97b53e | 283 | else if(SW2.read() == 1 & SW1.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 284 | { |
thomasmorris | 31:4a88bf97b53e | 285 | Subtract_Minute(); |
thomasmorris | 31:4a88bf97b53e | 286 | } |
thomasmorris | 31:4a88bf97b53e | 287 | LCD_Write_Minute(); |
thomasmorris | 31:4a88bf97b53e | 288 | |
thomasmorris | 31:4a88bf97b53e | 289 | if(SW1.read() & SW2.read() == 1) |
thomasmorris | 31:4a88bf97b53e | 290 | { |
thomasmorris | 31:4a88bf97b53e | 291 | mode = 7; |
thomasmorris | 31:4a88bf97b53e | 292 | break; |
thomasmorris | 31:4a88bf97b53e | 293 | } |
thomasmorris | 31:4a88bf97b53e | 294 | } |
thomasmorris | 30:4cde05cc7c4f | 295 | } |
thomasmorris | 30:4cde05cc7c4f | 296 | else if(mode == 7)//Set the Seconds |
thomasmorris | 30:4cde05cc7c4f | 297 | { |
thomasmorris | 30:4cde05cc7c4f | 298 | cout << "In Mode 7" << endl; |
thomasmorris | 31:4a88bf97b53e | 299 | LCD.Display_Clear(); |
thomasmorris | 31:4a88bf97b53e | 300 | while(1) |
thomasmorris | 31:4a88bf97b53e | 301 | { |
thomasmorris | 31:4a88bf97b53e | 302 | Thread::wait(1000); |
thomasmorris | 31:4a88bf97b53e | 303 | |
thomasmorris | 31:4a88bf97b53e | 304 | if(SW1.read() == 1 & SW2.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 305 | { |
thomasmorris | 31:4a88bf97b53e | 306 | Add_Second(); |
thomasmorris | 31:4a88bf97b53e | 307 | } |
thomasmorris | 31:4a88bf97b53e | 308 | else if(SW2.read() == 1 & SW1.read() == 0) |
thomasmorris | 31:4a88bf97b53e | 309 | { |
thomasmorris | 31:4a88bf97b53e | 310 | Subtract_Second(); |
thomasmorris | 31:4a88bf97b53e | 311 | } |
thomasmorris | 31:4a88bf97b53e | 312 | LCD_Write_Seconds(); |
thomasmorris | 31:4a88bf97b53e | 313 | |
thomasmorris | 31:4a88bf97b53e | 314 | if(SW1.read() & SW2.read() == 1) |
thomasmorris | 31:4a88bf97b53e | 315 | { |
thomasmorris | 31:4a88bf97b53e | 316 | mode = 0; |
thomasmorris | 31:4a88bf97b53e | 317 | break; |
thomasmorris | 31:4a88bf97b53e | 318 | } |
thomasmorris | 31:4a88bf97b53e | 319 | } |
thomasmorris | 30:4cde05cc7c4f | 320 | } |
thomasmorris | 30:4cde05cc7c4f | 321 | else |
thomasmorris | 30:4cde05cc7c4f | 322 | { |
thomasmorris | 30:4cde05cc7c4f | 323 | mode == 0; |
thomasmorris | 7:dfe19413fdc2 | 324 | } |
thomasmorris | 7:dfe19413fdc2 | 325 | } |
thomasmorris | 7:dfe19413fdc2 | 326 | } |
thomasmorris | 29:64b1f95a807c | 327 | void Serial_Commands()//Used for getting input from the user to determine the opperations to perform |
thomasmorris | 22:eb4cc12087b2 | 328 | { |
chills | 24:7d2da96e05ad | 329 | string Serial_Input; |
thomasmorris | 25:36699ed589ab | 330 | while(1) { |
thomasmorris | 25:36699ed589ab | 331 | Serial_Input = "Blank"; |
chills | 24:7d2da96e05ad | 332 | cout << "Please type in a command" << endl; |
thomasmorris | 25:36699ed589ab | 333 | |
thomasmorris | 22:eb4cc12087b2 | 334 | cin >> Serial_Input; |
thomasmorris | 25:36699ed589ab | 335 | |
thomasmorris | 22:eb4cc12087b2 | 336 | if (Serial_Input == "Test") |
thomasmorris | 22:eb4cc12087b2 | 337 | { |
chills | 24:7d2da96e05ad | 338 | cout << "Test Confirmed" << endl; |
thomasmorris | 30:4cde05cc7c4f | 339 | cout << "This is the time " << get_current_time() << endl; |
thomasmorris | 25:36699ed589ab | 340 | } |
thomasmorris | 25:36699ed589ab | 341 | else if(Serial_Input == "READALL") |
thomasmorris | 22:eb4cc12087b2 | 342 | { |
chills | 26:78f5e454e59f | 343 | cout << "Read All Confirmed " << Sample_Rate << endl; |
chills | 26:78f5e454e59f | 344 | Console_Output_Timer.attach(&Console_Output_ISR,Sample_Rate); |
thomasmorris | 25:36699ed589ab | 345 | } |
chills | 26:78f5e454e59f | 346 | else if(Serial_Input == "DELETEALL") |
chills | 26:78f5e454e59f | 347 | { |
chills | 27:807dd5660c4b | 348 | Sampling_Timer.detach(); |
chills | 27:807dd5660c4b | 349 | Console_Output_Timer.detach(); |
thomasmorris | 29:64b1f95a807c | 350 | for (int x = 0; x < mailsize; x++) |
thomasmorris | 29:64b1f95a807c | 351 | { |
chills | 27:807dd5660c4b | 352 | DATA *Delete_Data = mail_box.alloc(); //Allocate a block from the memory pool, Type Data |
chills | 27:807dd5660c4b | 353 | mail_box.free(Delete_Data); //Puts "Send_Data" into the mailbox |
chills | 27:807dd5660c4b | 354 | } |
chills | 27:807dd5660c4b | 355 | Sampling_Timer.attach(&Sampling_ISR,Sample_Rate); |
chills | 27:807dd5660c4b | 356 | cout << "Sampling Restarted" << endl; |
thomasmorris | 25:36699ed589ab | 357 | } |
chills | 27:807dd5660c4b | 358 | else if(Serial_Input == "READ") |
thomasmorris | 22:eb4cc12087b2 | 359 | { |
thomasmorris | 29:64b1f95a807c | 360 | cout << "Please enter in the number of samples to read" <<endl; |
thomasmorris | 29:64b1f95a807c | 361 | int Loops; cin >> Loops; |
thomasmorris | 29:64b1f95a807c | 362 | for (int x = 0; x < Loops; x++) |
thomasmorris | 29:64b1f95a807c | 363 | { |
thomasmorris | 29:64b1f95a807c | 364 | Serial_Comms_Stealth_Mode(); |
thomasmorris | 29:64b1f95a807c | 365 | } |
thomasmorris | 25:36699ed589ab | 366 | } |
chills | 26:78f5e454e59f | 367 | else if(Serial_Input == "DELETE") |
thomasmorris | 22:eb4cc12087b2 | 368 | { |
chills | 26:78f5e454e59f | 369 | Sampling_Timer.detach(); |
chills | 26:78f5e454e59f | 370 | Console_Output_Timer.detach(); |
chills | 26:78f5e454e59f | 371 | cout << "Number of samples to delete:" << endl; |
chills | 26:78f5e454e59f | 372 | int Loops; cin >> Loops; |
chills | 26:78f5e454e59f | 373 | for (int x = 0; x < Loops; x++){ |
chills | 26:78f5e454e59f | 374 | DATA *Delete_Data = mail_box.alloc(); //Allocate a block from the memory pool, Type Data |
chills | 26:78f5e454e59f | 375 | mail_box.free(Delete_Data); //Puts "Send_Data" into the mailbox |
chills | 26:78f5e454e59f | 376 | } |
chills | 26:78f5e454e59f | 377 | Sampling_Timer.attach(&Sampling_ISR,Sample_Rate); |
chills | 26:78f5e454e59f | 378 | cout << "Sampling Restarted" << endl; |
thomasmorris | 25:36699ed589ab | 379 | } |
thomasmorris | 25:36699ed589ab | 380 | else if(Serial_Input == "SETDATE") |
chills | 26:78f5e454e59f | 381 | { |
thomasmorris | 25:36699ed589ab | 382 | set_time(SETDATE()); |
chills | 26:78f5e454e59f | 383 | } |
thomasmorris | 25:36699ed589ab | 384 | else if(Serial_Input == "SETT") |
thomasmorris | 22:eb4cc12087b2 | 385 | { |
chills | 26:78f5e454e59f | 386 | float Temp_Sample_Rate = SETT(); |
chills | 26:78f5e454e59f | 387 | |
chills | 26:78f5e454e59f | 388 | if(Temp_Sample_Rate >= 1){Sample_Rate = Temp_Sample_Rate;} |
chills | 26:78f5e454e59f | 389 | |
chills | 26:78f5e454e59f | 390 | Sampling_Timer.detach(); |
chills | 26:78f5e454e59f | 391 | Console_Output_Timer.detach(); |
chills | 26:78f5e454e59f | 392 | Sampling_Timer.attach(&Sampling_ISR,Sample_Rate); |
thomasmorris | 25:36699ed589ab | 393 | } |
chills | 27:807dd5660c4b | 394 | else if(Serial_Input == "STATE") |
chills | 27:807dd5660c4b | 395 | { |
chills | 27:807dd5660c4b | 396 | Sampling_Timer.detach(); Console_Output_Timer.detach(); |
chills | 27:807dd5660c4b | 397 | cout << "Turn Sampling On or Off:" << endl; |
chills | 27:807dd5660c4b | 398 | string State; cin >> State; |
chills | 27:807dd5660c4b | 399 | |
chills | 27:807dd5660c4b | 400 | if(State == "On"){Sampling_Timer.attach(&Sampling_ISR,Sample_Rate);} |
chills | 27:807dd5660c4b | 401 | if(State == "Off"){Sampling_Timer.detach();} |
thomasmorris | 25:36699ed589ab | 402 | } |
thomasmorris | 25:36699ed589ab | 403 | else if(Serial_Input == "LOGGING.<x>") |
chills | 26:78f5e454e59f | 404 | { |
thomasmorris | 25:36699ed589ab | 405 | |
thomasmorris | 25:36699ed589ab | 406 | } |
thomasmorris | 25:36699ed589ab | 407 | else if(Serial_Input == "HELP")// Use this to display all of the availble commands |
thomasmorris | 25:36699ed589ab | 408 | { |
thomasmorris | 25:36699ed589ab | 409 | HELP(); |
thomasmorris | 22:eb4cc12087b2 | 410 | } |
chills | 26:78f5e454e59f | 411 | else if(Serial_Input == "STOP") |
chills | 26:78f5e454e59f | 412 | { |
thomasmorris | 28:09b5c46c8afd | 413 | Console_Output_Timer.detach(); //Stops Sampling |
chills | 26:78f5e454e59f | 414 | } |
thomasmorris | 30:4cde05cc7c4f | 415 | else if(Serial_Input == "Blank Blank") |
thomasmorris | 30:4cde05cc7c4f | 416 | { |
thomasmorris | 30:4cde05cc7c4f | 417 | cout << "Blank Blank complete" << endl; |
thomasmorris | 30:4cde05cc7c4f | 418 | } |
thomasmorris | 25:36699ed589ab | 419 | else |
thomasmorris | 22:eb4cc12087b2 | 420 | { |
chills | 26:78f5e454e59f | 421 | cout << "Please enter an acceptable command" << endl; |
thomasmorris | 22:eb4cc12087b2 | 422 | } |
thomasmorris | 22:eb4cc12087b2 | 423 | } |
thomasmorris | 22:eb4cc12087b2 | 424 | } |
thomasmorris | 29:64b1f95a807c | 425 | void Serial_Comms_Stealth_Mode()//Change this name |
thomasmorris | 29:64b1f95a807c | 426 | { |
thomasmorris | 29:64b1f95a807c | 427 | osEvent evt_serial = mail_box.get(); //Get the latest entry from "mail_box" |
thomasmorris | 29:64b1f95a807c | 428 | |
thomasmorris | 29:64b1f95a807c | 429 | DATA *Rec_Data_Serial = (DATA*)evt_serial.value.p; //Create pointer to mailbox |
thomasmorris | 29:64b1f95a807c | 430 | DATA msg_serial; //Create temporary instance of DATA class |
thomasmorris | 29:64b1f95a807c | 431 | |
thomasmorris | 29:64b1f95a807c | 432 | msg_serial.set_time(Rec_Data_Serial->get_time()); //Copy time from mailbox to temporary instance |
thomasmorris | 29:64b1f95a807c | 433 | msg_serial.set_temperature(Rec_Data_Serial->get_temperature()); //Copy teperature from mailbox to temporary instance |
thomasmorris | 29:64b1f95a807c | 434 | msg_serial.set_pressure(Rec_Data_Serial->get_pressure()); //Copy pressure from mailbox to temporary instance |
thomasmorris | 29:64b1f95a807c | 435 | msg_serial.set_light(Rec_Data_Serial->get_light()); //Copy light from mailbox to temporary instance |
thomasmorris | 29:64b1f95a807c | 436 | mail_box.free(Rec_Data_Serial); //Free space in the mailbox (delete earliest sample taken) |
thomasmorris | 29:64b1f95a807c | 437 | time_t scom_time = msg_serial.get_time(); //Declare local variable for time |
thomasmorris | 29:64b1f95a807c | 438 | strftime(scom_time_buffer, 32, "%I:%M %p\t", localtime(&scom_time)); //Format time as a string |
thomasmorris | 29:64b1f95a807c | 439 | pc.printf("Time = %s", scom_time_buffer); //Print the string formatted time |
thomasmorris | 29:64b1f95a807c | 440 | pc.printf("Temperature = %f\t", msg_serial.get_temperature()); //Print Temperature |
thomasmorris | 29:64b1f95a807c | 441 | pc.printf("Pressure = %f\t", msg_serial.get_pressure()); //Print Pressure |
thomasmorris | 29:64b1f95a807c | 442 | pc.printf("Light = %f\n\r", msg_serial.get_light()); //Print Light |
thomasmorris | 29:64b1f95a807c | 443 | |
thomasmorris | 29:64b1f95a807c | 444 | Green_led.Toggle(); |
thomasmorris | 29:64b1f95a807c | 445 | } |
chills | 24:7d2da96e05ad | 446 | void Serial_Comms()//Thread for Serial Communications |
thomasmorris | 5:2594b953f111 | 447 | { |
thomasmorris | 25:36699ed589ab | 448 | while(1) { |
thomasmorris | 28:09b5c46c8afd | 449 | Thread::signal_wait(SerialCommsTime);//Stupid 0 Bug |
thomasmorris | 29:64b1f95a807c | 450 | Serial_Comms_Stealth_Mode(); |
thomasmorris | 5:2594b953f111 | 451 | } |
thomasmorris | 5:2594b953f111 | 452 | } |
thomasmorris | 5:2594b953f111 | 453 | |
thomasmorris | 28:09b5c46c8afd | 454 | void Console_Output_ISR() {t2.signal_set(SerialCommsTime);} |
chills | 26:78f5e454e59f | 455 | void Sampling_ISR() {t1.signal_set(SamplingTime);} |
chills | 26:78f5e454e59f | 456 | |
chills | 26:78f5e454e59f | 457 | |
thomasmorris | 5:2594b953f111 | 458 | void Sample()//Samples the hardware and prints the result to the LCD |
thomasmorris | 5:2594b953f111 | 459 | { |
thomasmorris | 30:4cde05cc7c4f | 460 | while(1) |
thomasmorris | 30:4cde05cc7c4f | 461 | { |
chills | 10:46946784326d | 462 | Thread::signal_wait(SamplingTime); //Set the time between samples |
thomasmorris | 25:36699ed589ab | 463 | |
chills | 10:46946784326d | 464 | temp = sensor.getTemperature(); //Read Temperature |
chills | 10:46946784326d | 465 | pressure = sensor.getPressure(); //Read Pressure |
chills | 10:46946784326d | 466 | lux = adcIn.read(); //Read Light |
chills | 16:067916791a25 | 467 | time_t buffer_time = time(NULL); //Read Time |
thomasmorris | 25:36699ed589ab | 468 | |
chills | 16:067916791a25 | 469 | DATA *Send_Data = mail_box.alloc(); //Allocate a block from the memory pool, Type Data |
thomasmorris | 25:36699ed589ab | 470 | |
thomasmorris | 25:36699ed589ab | 471 | if (Send_Data == NULL) { //If Data is empty |
chills | 16:067916791a25 | 472 | //pc.printf("Out of memory\n\r"); //Print out of memory warning |
chills | 10:46946784326d | 473 | return; |
chills | 10:46946784326d | 474 | } |
chills | 10:46946784326d | 475 | Send_Data->set_time(buffer_time); //Pass in Time |
chills | 10:46946784326d | 476 | Send_Data->set_temperature(temp); //Pass in Temp |
chills | 10:46946784326d | 477 | Send_Data->set_pressure(pressure); //Pass in Pres |
chills | 10:46946784326d | 478 | Send_Data->set_light(lux); //Pass in Light |
thomasmorris | 25:36699ed589ab | 479 | |
chills | 10:46946784326d | 480 | osStatus stat = mail_box.put(Send_Data); //Puts "Send_Data" into the mailbox |
thomasmorris | 25:36699ed589ab | 481 | |
thomasmorris | 25:36699ed589ab | 482 | if (stat == osErrorResource) { //If mailbox overfills |
chills | 10:46946784326d | 483 | mail_box.free(Send_Data); //Free the mail box |
chills | 10:46946784326d | 484 | } |
thomasmorris | 5:2594b953f111 | 485 | Red_led.Toggle(); |
thomasmorris | 5:2594b953f111 | 486 | t1.signal_set(NotSamplingTime); |
thomasmorris | 5:2594b953f111 | 487 | } |
thomasmorris | 25:36699ed589ab | 488 | } |
thomasmorris | 25:36699ed589ab | 489 | int main() |
thomasmorris | 25:36699ed589ab | 490 | { |
noutram | 1:e1cf7663f5ff | 491 | //Greeting |
chills | 16:067916791a25 | 492 | pc.printf("Test Start"); |
chills | 16:067916791a25 | 493 | pc.printf("\n\r"); |
thomasmorris | 25:36699ed589ab | 494 | |
chills | 10:46946784326d | 495 | set_time(1512940530); //Set RTC time to December 10 2017 |
thomasmorris | 30:4cde05cc7c4f | 496 | |
chills | 10:46946784326d | 497 | pc.baud(9600); //Sets the Serial Comms Baud Rate |
thomasmorris | 25:36699ed589ab | 498 | |
chills | 20:cbb71f84cff9 | 499 | LCD.Initialise(); |
thomasmorris | 28:09b5c46c8afd | 500 | LCD.DDRAM_Address(0x00); |
thomasmorris | 29:64b1f95a807c | 501 | |
thomasmorris | 25:36699ed589ab | 502 | post(); //Power on Self Test |
thomasmorris | 25:36699ed589ab | 503 | |
noutram | 3:a88838ff33e7 | 504 | //Initialise the SD card (this needs to move) |
noutram | 1:e1cf7663f5ff | 505 | if ( sd.init() != 0) { |
noutram | 1:e1cf7663f5ff | 506 | printf("Init failed \n"); |
thomasmorris | 28:09b5c46c8afd | 507 | LCD.Display_Clear(); |
thomasmorris | 28:09b5c46c8afd | 508 | LCD.Write_String("CANNOT INIT SD"); //Change me |
noutram | 1:e1cf7663f5ff | 509 | errorCode(FATAL); |
thomasmorris | 25:36699ed589ab | 510 | } |
noutram | 1:e1cf7663f5ff | 511 | //Create a filing system for SD Card |
thomasmorris | 25:36699ed589ab | 512 | FATFileSystem fs("sd", &sd); |
noutram | 0:36e89e3ed7c4 | 513 | |
noutram | 1:e1cf7663f5ff | 514 | //Open to WRITE |
noutram | 1:e1cf7663f5ff | 515 | FILE* fp = fopen("/sd/test.csv","a"); |
noutram | 1:e1cf7663f5ff | 516 | if (fp == NULL) { |
noutram | 1:e1cf7663f5ff | 517 | error("Could not open file for write\n"); |
thomasmorris | 28:09b5c46c8afd | 518 | LCD.Display_Clear(); |
thomasmorris | 28:09b5c46c8afd | 519 | LCD.Write_String("CANNOT OPEN FILE\n\n");//Change me |
noutram | 1:e1cf7663f5ff | 520 | errorCode(FATAL); |
noutram | 1:e1cf7663f5ff | 521 | } |
noutram | 3:a88838ff33e7 | 522 | //Last message before sampling begins |
thomasmorris | 28:09b5c46c8afd | 523 | LCD.Display_Clear(); |
thomasmorris | 31:4a88bf97b53e | 524 | LCD.Write_String("READY Player"); |
thomasmorris | 31:4a88bf97b53e | 525 | LCD.DDRAM_Address(0x40); |
thomasmorris | 31:4a88bf97b53e | 526 | LCD.Write_String("ONE"); |
thomasmorris | 31:4a88bf97b53e | 527 | LCD.DDRAM_Address(0x00); |
thomasmorris | 25:36699ed589ab | 528 | |
thomasmorris | 25:36699ed589ab | 529 | |
thomasmorris | 25:36699ed589ab | 530 | Sample_Rate = TimerInterval; |
chills | 24:7d2da96e05ad | 531 | //Run interrupt |
chills | 26:78f5e454e59f | 532 | Sampling_Timer.attach(&Sampling_ISR,Sample_Rate); |
chills | 24:7d2da96e05ad | 533 | |
thomasmorris | 5:2594b953f111 | 534 | t1.start(Sample); |
chills | 26:78f5e454e59f | 535 | t2.start(Serial_Comms); |
thomasmorris | 30:4cde05cc7c4f | 536 | t3.start(LCD_Output); |
chills | 24:7d2da96e05ad | 537 | //t4.start(Network); |
thomasmorris | 23:3c85d7f657a2 | 538 | t5.start(Serial_Commands); |
thomasmorris | 25:36699ed589ab | 539 | |
thomasmorris | 5:2594b953f111 | 540 | //Main thread ID |
thomasmorris | 25:36699ed589ab | 541 | |
thomasmorris | 5:2594b953f111 | 542 | idMain = osThreadGetId(); //CMSIS RTOS call |
thomasmorris | 25:36699ed589ab | 543 | |
thomasmorris | 5:2594b953f111 | 544 | //Thread ID |
thomasmorris | 5:2594b953f111 | 545 | id1 = t1.gettid(); |
thomasmorris | 5:2594b953f111 | 546 | id2 = t2.gettid(); |
thomasmorris | 21:3c078c799caa | 547 | id3 = t3.gettid(); |
thomasmorris | 21:3c078c799caa | 548 | id4 = t4.gettid(); |
chills | 24:7d2da96e05ad | 549 | id5 = t5.gettid(); |
thomasmorris | 25:36699ed589ab | 550 | |
thomasmorris | 25:36699ed589ab | 551 | while (onBoardSwitch == 0) { |
thomasmorris | 25:36699ed589ab | 552 | |
noutram | 1:e1cf7663f5ff | 553 | } |
thomasmorris | 25:36699ed589ab | 554 | |
noutram | 1:e1cf7663f5ff | 555 | //Close File |
chills | 15:c1592fc1a501 | 556 | /* |
noutram | 1:e1cf7663f5ff | 557 | fclose(fp); |
thomasmorris | 25:36699ed589ab | 558 | |
noutram | 1:e1cf7663f5ff | 559 | //Close down |
noutram | 1:e1cf7663f5ff | 560 | sd.deinit(); |
noutram | 1:e1cf7663f5ff | 561 | printf("Unmounted...\n"); |
noutram | 1:e1cf7663f5ff | 562 | lcd.cls(); |
noutram | 1:e1cf7663f5ff | 563 | lcd.printf("Unmounted...\n\n"); |
chills | 15:c1592fc1a501 | 564 | */ |
thomasmorris | 25:36699ed589ab | 565 | |
noutram | 1:e1cf7663f5ff | 566 | while(true) { |
noutram | 1:e1cf7663f5ff | 567 | greenLED = 1; |
noutram | 1:e1cf7663f5ff | 568 | wait(0.5); |
noutram | 1:e1cf7663f5ff | 569 | greenLED = 0; |
thomasmorris | 25:36699ed589ab | 570 | wait(0.1); |
noutram | 0:36e89e3ed7c4 | 571 | } |
noutram | 0:36e89e3ed7c4 | 572 | } |