From 4ba6c6b0dd531321fa1e9bd04b64d817b8504929 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 28 Mar 2020 16:17:13 -0400 Subject: [PATCH] board sensing added --- afsk/telem.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/afsk/telem.c b/afsk/telem.c index 9d9a369a..8e4815ba 100644 --- a/afsk/telem.c +++ b/afsk/telem.c @@ -170,6 +170,40 @@ int main(int argc, char *argv[]) { wiringPiSetup (); printf("\n"); + + pinMode (2, INPUT); + pullUpDnControl (2, PUD_UP); + + if (digitalRead(2) != HIGH) + { + printf("vB3 with TFB Present\n"); + } + else + { + pinMode (3, INPUT); + pullUpDnControl (3, PUD_UP); + + if (digitalRead(3) != HIGH) + { + printf("vB4 Present\n"); + + } + else + { + pinMode (26, INPUT); + pullUpDnControl (26, PUD_UP); + + if (digitalRead(26) != HIGH) + { + printf("vB5 Present\n"); + + } + else + { + printf("VB3 Present\n"); + } + } + } sensorV = config_sensor("/dev/i2c-1", 0x40, 400); readingV = read_sensor_data(sensorV);