Hello everyone,
This is my second to last post on this challenge. Everything is now complete except for the vlog on the project working in the vehicle. Below are pictures of the project on my computer desk and the code for the Nucleo. I programmed the Nucleo with the Arduino IDE which worked perfectly (almost, there were a few little bugs). Please leave any questions or comments below.
Note: There are 2 tilt sensors that will be attached to the drivers head to sense if they are nodding off. The first is set at a warning angle and the second is set at a full alert angle (I will demonstrate this in my final vlog). Thank you DAB for the idea!!
Note 2: I had to delete the heart rate sensor as I couldn't get it working correctly.
Thank you for following
Dale Winhold
#include <f401reMap.h> int vibPin = pinMap(5); int tiltPinB = pinMap(6); int tiltPin = pinMap(7); int ledPin = pinMap(8); int ledPinB = pinMap(9); int soundPin = pinMap(10); int soundPinB = pinMap(11); int buzzerPin = pinMap(1); int wheelPin = pinMap(12); int tilt = 0; int tiltB = 0; int sound = 0; int soundB = 0; int vib = 0; int wheel = 0; void setup() { pinMode(ledPin, OUTPUT); pinMode(ledPinB, OUTPUT); pinMode(tiltPin, INPUT); pinMode(tiltPinB, INPUT); pinMode(soundPin, INPUT); pinMode(soundPinB, INPUT); pinMode(vibPin, INPUT); pinMode(buzzerPin, OUTPUT); pinMode(wheelPin, INPUT); } void loop() { tilt = digitalRead(tiltPin); tiltB = digitalRead(tiltPinB); sound = digitalRead(soundPin); soundB = digitalRead(soundPinB); vib = digitalRead(vibPin); wheel = digitalRead(wheelPin); if (tilt == HIGH) { digitalWrite(ledPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(250); } if (tiltB == HIGH) { digitalWrite(ledPinB, HIGH); digitalWrite(buzzerPin, HIGH); delay(250); } if (sound == HIGH) { digitalWrite(ledPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(500); } if (soundB == HIGH) { digitalWrite(ledPinB, HIGH); digitalWrite(buzzerPin, HIGH); delay(500); } if (vib == HIGH) { digitalWrite(ledPin, HIGH); digitalWrite(buzzerPin, HIGH); delay(750); } if (wheel == HIGH) { digitalWrite(ledPinB, HIGH); digitalWrite(buzzerPin, HIGH); delay(500); } else { digitalWrite(ledPin, LOW); digitalWrite(ledPinB, LOW); digitalWrite(buzzerPin, LOW); } }