Skip to content
Prev Previous commit
Next Next commit
Test apps
  • Loading branch information
jahnavithota2011 committed Jul 11, 2022
commit 827f80cc9881cb1e11b0d0b668b5721e5d4ae714
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ add_app_subdirectory(${TEST_APPS_DIR}/test-quadrature64cpr)
add_app_subdirectory(${TEST_APPS_DIR}/test-stress-can)
add_app_subdirectory(${TEST_APPS_DIR}/test-units)
add_app_subdirectory(${TEST_APPS_DIR}/test-watchdog)
add_app_subdirectory(${TEST_APPS_DIR}/test-CO2-sensor)
add_app_subdirectory(${TEST_APPS_DIR}/test-moisture-sensor)

# Ensure APP was specified
if ("$ENV{APP}" STREQUAL "")
Expand Down
2 changes: 1 addition & 1 deletion rover-apps/arm_2021/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "TurntableConfig.h"
#include "WristConfig.h"

CANInterface can(CANConfig::config);
CANInterface can(CANConfig::config) ;

// Convert degrees to radians
static inline float DEG_TO_RAD(float deg) {
Expand Down
8 changes: 8 additions & 0 deletions supported_build_configurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,13 @@ test-stress-can:
- ARM_REV2_2021
- GIMBAL_REV2_2021
- PDB_REV2_2021
- SCIENCE_REV2_2021
- UWRT_NUCLEO

test-moisture-sensor:
- SCIENCE_REV2_2021
- UWRT_NUCLEO

test-CO2-sensor:
- SCIENCE_REV2_2021
- UWRT_NUCLEO
4 changes: 4 additions & 0 deletions test-apps/test-CO2-sensor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_executable(test-CO2-sensor)
target_sources(test-CO2-sensor PRIVATE src/main.cpp)
target_link_libraries(test-CO2-sensor PRIVATE PollingSensors Logger)
mbed_set_post_build(test-CO2-sensor)
20 changes: 20 additions & 0 deletions test-apps/test-CO2-sensor/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "PollingSensors.h"
#include "PinNames.h"
#include "Logger.h"

DigitalOut led1(LED1);

int main() {
Sensor::PollingSensors CO2_sensor(PA_0,PA_1);

while (1) {

printf("\r\nReading CO2 Levels...\r\n");

Utility::logger << "CO2: " << ((unsigned int) CO2_sensor.C02_monitoring()) << "\r\n";

printf("\r\n-----------------------------\r\n");

ThisThread::sleep_for(100ms);
}
}
4 changes: 4 additions & 0 deletions test-apps/test-moisture-sensor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_executable(test-moisture-sensor)
target_sources(test-moisture-sensor PRIVATE src/main.cpp)
target_link_libraries(test-moisture-sensor PRIVATE PollingSensors Logger)
mbed_set_post_build(test-moisture-sensor)
20 changes: 20 additions & 0 deletions test-apps/test-moisture-sensor/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "PollingSensors.h"
#include "PinNames.h"
#include "Logger.h"

DigitalOut led1(LED1);

int main() {
Sensor::PollingSensors moisture_sensor(PA_0, PA_1);

while (1) {

printf("\r\nReading moisture Levels...\r\n");

Utility::logger << "Moisture: " << ((unsigned int) moisture_sensor.moisture_monitoring()) << "\r\n";

printf("\r\n-----------------------------\r\n");

ThisThread::sleep_for(100ms);
}
}