C++ Library for the PsiSwarm Robot - Version 0.8
Dependents: PsiSwarm_V8_Blank_CPP Autonomia_RndmWlk
Fork of PsiSwarmV7_CPP by
Diff: demo.cpp
- Revision:
- 10:e58323951c08
- Parent:
- 9:dde9e21030eb
- Child:
- 11:312663037b8c
diff -r dde9e21030eb -r e58323951c08 demo.cpp --- a/demo.cpp Sun Oct 16 14:12:49 2016 +0000 +++ b/demo.cpp Sun Oct 16 16:00:20 2016 +0000 @@ -712,40 +712,40 @@ strcpy(topline,"--SENSORS MENU--"); switch(sub_menu) { case 0: { - float battery = get_battery_voltage (); + float battery = sensors.get_battery_voltage (); sprintf(bottomline,"BATTERY: %1.3fV",battery); break; } case 1: { - float dc = get_dc_voltage (); + float dc = sensors.get_dc_voltage (); sprintf(bottomline,"DC: %1.3fV",dc); break; } case 2: { - float current = get_current (); + float current = sensors.get_current (); sprintf(bottomline,"CURRENT: %1.3fA",current); break; } case 3: { - float temperature = get_temperature(); + float temperature = sensors.get_temperature(); sprintf(bottomline,"TEMP: %3.2fC", temperature); break; } case 4: - store_background_base_ir_values(); - sprintf(bottomline,"BIR%dB:%d",base_ir_index+1,get_background_base_ir_value(base_ir_index)); + sensors.store_background_base_ir_values(); + sprintf(bottomline,"BIR%dB:%d",base_ir_index+1,sensors.get_background_base_ir_value(base_ir_index)); break; case 5: - store_illuminated_base_ir_values(); - sprintf(bottomline,"BIR%dR:%d",base_ir_index+1,get_illuminated_base_ir_value(base_ir_index)); + sensors.store_illuminated_base_ir_values(); + sprintf(bottomline,"BIR%dR:%d",base_ir_index+1,sensors.get_illuminated_base_ir_value(base_ir_index)); break; case 6: - store_background_raw_ir_values(); - sprintf(bottomline,"SIR%dB:%d",side_ir_index+1,get_background_raw_ir_value(side_ir_index)); + sensors.store_background_raw_ir_values(); + sprintf(bottomline,"SIR%dB:%d",side_ir_index+1,sensors.get_background_raw_ir_value(side_ir_index)); break; case 7: - store_illuminated_raw_ir_values(); - sprintf(bottomline,"SIR%dR:%d",side_ir_index+1,get_illuminated_raw_ir_value(side_ir_index)); + sensors.store_illuminated_raw_ir_values(); + sprintf(bottomline,"SIR%dR:%d",side_ir_index+1,sensors.get_illuminated_raw_ir_value(side_ir_index)); break; case 8: sprintf(bottomline,"SIR%dD:%3.1f",side_ir_index+1,0.0); @@ -754,10 +754,10 @@ if(ultrasonic_distance_updated == 1) { sprintf(bottomline,"USONIC:%3dcm",ultrasonic_distance); } else sprintf(bottomline,"USONIC:---------"); - update_ultrasonic_measure(); + sensors.update_ultrasonic_measure(); break; case 10: - store_line_position(); + sensors.store_line_position(); if(line_found == 1)sprintf(bottomline,"LINE:%1.3f",line_position); else sprintf(bottomline,"LINE:---------"); break; @@ -941,7 +941,7 @@ void line_demo_cycle() { if(demo_timer.read() > time_out) { - store_line_position(); + sensors.store_line_position(); if(line_found) { time_out = 0.01f; state = 0; @@ -1317,9 +1317,9 @@ state = 1; break; case 1: { //Motor is moving forward - store_ir_values(); - int front_right = read_illuminated_raw_ir_value(0); - int front_left = read_illuminated_raw_ir_value(7); + sensors.store_ir_values(); + int front_right = sensors.read_illuminated_raw_ir_value(0); + int front_left = sensors.read_illuminated_raw_ir_value(7); if(front_left > 400 || front_right > 400) { motors.brake(); time_out = 0.04;