Skip to content
Snippets Groups Projects
Commit 24fdfae1 authored by pragya.anur@duke.edu's avatar pragya.anur@duke.edu
Browse files

final submission

parent 45c92794
Branches main
No related tags found
No related merge requests found
Pipeline #459919 passed
#winning.PNG

446 KiB

This diff is collapsed.
BLE State Diagram.png

167 KiB

100 HZ,Vpp,Brightness
10,0.85,10.69
10,0.89,10.74
10,0.98,10.89
20,1.15,11.14
20,1.23,11.18
20,1.43,11.63
30,1.68,11.95
30,1.75,12.36
30,1.89,12.22
40,2.35,13.43
40,2.42,13.51
40,2.55,13.65
50,3.61,15.61
50,3.51,16.15
50,3.66,15.67
\ No newline at end of file
......@@ -141,7 +141,6 @@ float max_data_array2[PERIOD_ARRAY]={};
float min_data_array2[PERIOD_ARRAY]={};
enum data_outputs {LED1_Brightness, LED2_Brightness, Pressure};
//int16_t data_output[3]= {};
int16_t data_output[3];
/******************************************************************************************/
//BLUETOOTH STUFF
......@@ -235,8 +234,6 @@ struct bt_remote_srv_cb remote_service_callbacks = {
.data_rx = on_data_rx,
};
//int16_t compliance_data; //going to have to change to a enum that holds 3 data values in an array
/******************************************************************************************/
static const struct adc_dt_spec vadc_battery = ADC_DT_SPEC_GET_BY_ALIAS(vadc);
......@@ -389,14 +386,14 @@ static void idle_run(void *o)
{
//LOG_INF("IDLE RUN");
// float atm_pressure_kPa = read_pressure_sensor(pressure_in, OVERSAMPLE, 0);
// data_output[pressure] = atm_kPa;
// k_msleep(MEASUREMENT_DELAY_MS);
float atm_pressure_kPa = read_pressure_sensor(pressure_in, OVERSAMPLE, 0);
data_output[Pressure] = atm_pressure_kPa;
k_msleep(MEASUREMENT_DELAY_MS);
// if (atm_pressure_kPa <= 0)
// {
// smf_set_state(SMF_CTX(&s_obj), &states[Pressure_Error]);
// }
if (atm_pressure_kPa <= 0)
{
smf_set_state(SMF_CTX(&s_obj), &states[Pressure_Error]);
}
usbregstatus = nrf_power_usbregstatus_vbusdet_get(NRF_POWER);
if (usbregstatus==true)
......@@ -421,7 +418,7 @@ static void action_run(void *o)
k_timer_start(&led_timer, K_MSEC(100), K_MSEC(100));
k_timer_start(&led2_timer,K_MSEC(100), K_MSEC(100));
//atm_pressure_kPa = read_pressure_sensor(pressure_in, OVERSAMPLE, 0);
atm_pressure_kPa = read_pressure_sensor(pressure_in, OVERSAMPLE, 0);
//LOG_INF("Pressure: %lld", atm_pressure_kPa);
}
......@@ -899,9 +896,10 @@ void button2_work_handler(struct k_work *button1_work)
// this function retrieves BAS GATT with information
battery_level = bt_bas_get_battery_level();
data_output[LED1_Brightness]=50;
data_output[LED2_Brightness]=90;
data_output[Pressure]=102;
//used these values to check if bluetooth was working with hard coded values
// data_output[LED1_Brightness]=50;
// data_output[LED2_Brightness]=90;
// data_output[Pressure]=102;
LOG_INF("LED1 Brightness :%d",data_output[LED1_Brightness]);
LOG_INF("LED2 Brightness :%d",data_output[LED2_Brightness]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment