Hey Guys Welcome to yet another Very Short UPDATE Blog Post on Smart Bike Smart Rider Project for IoTonWheels Design Challenge. In this Blog Post I will Go through testing and setting up the Hall effect Sensor With the STM32 Board using mBed Toolchain.
So in the last post we had fabricated our sensor board Now lets interface it
In this image Pin one on Top is the Vcc (+3.3V), Middle is GND and Bottom is Vo (i.e Signal pin)
So the sensor by defaults Outputs a High i.e. Logic 1 when no external Magnetic element is found, and Outputs a Low, i.e. Logic 0 when South (SOUTH) pole of the magnet crosses close to the sensor.
In my first test I created a Stand Alone Application to test the above functionality using Interrupts as that is what I want
<CODE>
#include "mbed.h"
DigitalOut myled(LED1);
InterruptIn hallSensor(PA_12);
// Hall Sensor Vout Connected to P8. and GND and VCC Connected to GND and +3.3v Respectively
// pb Interrupt routine - is interrupt activated by a falling edge of pb input
void hallSensor_ISR (void) {
myled = !myled;
}
int main() {
hallSensor.fall(&hallSensor_ISR);
// Blink myled in main routine when the Int occurs
// via interrupts that activate hallSensor_ISR routine
while (1) {
}
}
<CODE ENDS>
NOTE : I will do a blog on introduction and playing with mBed platform for now I wanted to keep this one very short and crisp
To my surprise the code worked In first attempt and I had tears of Joy coming from my eyes. (No I am not a CryBaby This was the First time something Worked with ST and mBED !!)
Regards,
GS Gill
P.S. As usual, any comments of your's is a valuable Feedback and a potential scope of improvement of content I publish.
Top Comments