Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 2:54c537a2569a, committed 2018-01-26
- Comitter:
- joseph_adamu
- Date:
- Fri Jan 26 13:20:05 2018 +0000
- Parent:
- 1:dc648c5624b9
- Commit message:
- cw_final_thr;
Changed in this revision
--- a/main.cpp Wed Jan 10 09:50:29 2018 +0000 +++ b/main.cpp Fri Jan 26 13:20:05 2018 +0000 @@ -2,13 +2,13 @@ #include "TextLCD.h" #include "operation.h" #include "BMP280.h" -//#include "Networkbits.hpp" +#include "Networkbits.hpp" Ticker display; // timer interrupt Ticker second_pass; // timer interrupt InterruptIn button(USER_BUTTON); // setting the b;ue button on the board -Thread t1,t2; // class allows defining, creating, and controlling thread functions in the system. +Thread t1,t2,t3; // class allows defining, creating, and controlling thread functions in the system. @@ -20,13 +20,14 @@ { button_select_date(); } - bmp280.initialize(); // intialisation of the BMP280 sesnor + bmp.initialize(); // intialisation of the BMP280 sesnor pc.printf("putty ready\n\r"); display.attach(&dis_store_sensor_data, 2.0); button.rise(&disp_check); second_pass.attach(&tick, 1.0); t1.start(disp_putty); // start thread of the function disp_putty t2.start( disp_check); // start thread of the function disp_putty + t3.start( networktest); // start thread of the function networktest while(1) {
--- a/print_LCD.h Wed Jan 10 09:50:29 2018 +0000 +++ b/print_LCD.h Fri Jan 26 13:20:05 2018 +0000 @@ -22,7 +22,7 @@ lcd.locate(2,1); lcd.printf(":"); lcd.locate(3,1); - lcd.printf("%i", mi); + lcd.printf("%i", mi); lcd.locate(4,1); lcd.printf("%i", mmi); lcd.locate(5,1);
--- a/putty.h Wed Jan 10 09:50:29 2018 +0000 +++ b/putty.h Fri Jan 26 13:20:05 2018 +0000 @@ -7,7 +7,7 @@ char input_user[40] = {0}; // user input array can store up to 40 elements of type char char input_user2[40] = {0}; // user input array 2 can store up to 40 elements of type char -int n, datan = 0, datac = 0, counterd = 0; //integer for datan datac +int n, data_num = 0, data_cout = 0, counterd = 0; //integer for data_num data_cout int set_dates =0, clocks= 0; int output; int stoppingit; @@ -19,25 +19,25 @@ /*---------------------------------------------------------*/ void readall() { - datan = counter_store; // getting the 120 past record + data_num = counter_store; // getting the 120 past record pc.printf("readall selected\n\r"); // printing readall to the putty if (full == 1) { - datac = 120; + data_cout = 120; } else { - datac = counter_store; + data_cout = counter_store; } - pc.printf("printting %i datas\n\r", datac); // printing the - while (counterd < datac) + pc.printf("printting %i datas\n\r", data_cout); // printing the + while (counterd < data_cout) { - pc.printf("light: %2.4f, temp: %3.4f, press: %3.4f\n\r", temperature_data [datan], pressure_data[datan], LDR_data[datan]); // printing all the BMP280 sensor data to putty - if (datan == 0) + pc.printf(" Temperature: %2.4f, Pressure: %3.4f, LDR: %3.4f\n\r", temperature_data [data_num], pressure_data[data_num], LDR_data[data_num]); // printing all the BMP280 sensor data to putty + if (data_num == 0) { - datan = 121; + data_num = 121; } - datan--; + data_num--; counterd++; } counterd = 0; @@ -61,12 +61,12 @@ { while (counterd < n) { - pc.printf("light: %2.4f, temp: %3.4f, press: %3.4f\n\r", temperature_data [datan], pressure_data[datan], LDR_data[datan]); // printing the sensor data to putty - if (datan == 0) + pc.printf(" Temperature: %2.4f, Pressure: %3.4f, LDR: %3.4f\n\r", temperature_data [data_num], pressure_data[data_num], LDR_data[data_num]); // printing all the BMP280 sensor data to putty + if (data_num == 0) { - datan = 121; + data_num = 121; } - datan--; + data_num--; counterd++; } } @@ -98,7 +98,7 @@ void deleten() { - datan = counter_store; + data_num = counter_store; counterd = 0; n = atoi(input_user2); if (n > counter_store && full == 0) @@ -115,11 +115,11 @@ counter_store = counter_store-n; while (counterd < n) { - LDR_data[datan] = 0; - temperature_data [datan] = 0; - pressure_data[datan] = 0; + LDR_data[data_num] = 0; + temperature_data [data_num] = 0; + pressure_data[data_num] = 0; counterd ++; - datan--; + data_num--; } } else if(full == 1 && n < 120) @@ -128,11 +128,11 @@ counter_store = counter_store-n; while (counterd < 120) { - LDR_data[datan] = 0; - temperature_data [datan] = 0; - pressure_data[datan] = 0; + LDR_data[data_num] = 0; + temperature_data [data_num] = 0; + pressure_data[data_num] = 0; counterd ++; - datan--; + data_num--; } } } @@ -164,7 +164,7 @@ void read_or_read_all() { counterd = 0; - datan = counter_store-1; + data_num = counter_store-1; if (input_user[0] == 'R'&& input_user[1] == 'E'&& input_user[2] == 'A'&& input_user[3] == 'D') { if (input_user2[0] == 'A'&& input_user2[1]== 'L'&& input_user2[2]== 'L') @@ -233,7 +233,7 @@ hh =clocks%10; clocks /= 10; - pc.printf("TIME UPDATED TO %i%i:%i%i:%i%i%i%i\n\r",hh,h,mmi,mi,ss,s); + pc.printf("TIME UPDATED TO %i%i:%i%i:%i%i\n\r",hh,h,mmi,mi,s,ss); } @@ -246,24 +246,24 @@ if (input_user[0] == 'D'&& input_user[1] == 'A'&& input_user[2] == 'T'&& input_user[3] == 'E') { set_dates = atoi (input_user2); -d= set_dates%10; +yyyy =set_dates&10; + set_dates /= 10; +yyy =set_dates%10; + set_dates /= 10; +yy =set_dates%10; set_dates /= 10; -dd = set_dates%10; -set_dates /= 10; -m=set_dates%10; +y =set_dates%10; set_dates /= 10; mm =set_dates%10; set_dates /= 10; -y =set_dates%10; +m=set_dates%10; set_dates /= 10; -yy =set_dates%10; +dd = set_dates%10; set_dates /= 10; -yyy =set_dates%10; - set_dates /= 10; -yyyy =set_dates&10; - set_dates /= 10; + d= set_dates%10; +set_dates /= 10; -pc.printf("DATE UPDATED TO %i%i/%i%i/%i%i%i%i\n\r",yyyy,yyy,yy,y,mm,m,dd,d); +pc.printf("DATE UPDATED TO %i%i/%i%i/%i%i%i%i\n\r",d,dd,m,mm,y,yy,yyy,yyyy); } }
--- a/sensor_data.h Wed Jan 10 09:50:29 2018 +0000 +++ b/sensor_data.h Fri Jan 26 13:20:05 2018 +0000 @@ -3,9 +3,9 @@ #include "calender_operation.h" float getTemperature_bmp280; // Read the current Temperature value from BME280 sensor float getPressure_bmp280; // Read the current humidity value (humidity %) from BME280 sensor -float fLDR; // Read the current light intensity value from LDR sensor +float fLDR =0.0; // Read the current light intensity value from LDR sensor float temperature_data [120], pressure_data[120], LDR_data[120]; -BMP280 bmp280(D14,D15,0x77); //Assigning the pin for BMP280 Pressure sensor +BMP280 bmp(D14,D15,0x76); //Assigning the pin for BMP280 Pressure sensor AnalogIn LDR(A1); //Assigning the pin for LDR int counter_store = 0, full = 0, day, month, year, leap; @@ -150,22 +150,22 @@ //Sensor setup void sensor_operation() { - getTemperature_bmp280 = bmp280.getTemperature(); + getTemperature_bmp280 = bmp.getTemperature(); - getPressure_bmp280 = bmp280.getPressure(); + getPressure_bmp280 = bmp.getPressure(); fLDR = LDR; } //******* Displaying sensor data to the lcd to allocated position ************* void sensor_lcd() { - lcd.locate(10,0); + lcd.locate(0,0); lcd.printf("L:%1.2f", fLDR); - lcd.locate(0,0); + lcd.locate(8,0); lcd.printf("P:%3.1f", getPressure_bmp280); - lcd.locate(10,1); - lcd.printf("T:%3.1f", getTemperature_bmp280); + lcd.locate(9,1); + lcd.printf("T:%5.1f", getTemperature_bmp280); } void records() {