151
Wirelings / Re: AST1006-D
« on: January 27, 2022, 12:45:07 PM »
Hiya JS,
I know I answered this over email, but I thought I would copy the response here if anyone else runs into the same question:
The digital hall sensor relies on an analog pin rather than an I2C (SDA/SCL) connection. So the three pins you would need to connect are A0, GND, and 3.3V. Then you could use this code example that I have modified from what’s available in the tutorial(https://learn.tinycircuits.com/Wirelings/Hall-Effect_Wireling_Tutorial/#digital-hall-effect-wireling):
For the three pins you would need to connect to the Arduino Uno (GND, 3V3,INT), you can look at the diagram in this tutorial: https://tinycircuits.com/blogs/learn/make-your-own-wireling-using-a-wireling-cable
The Breakout Wireling is a great quick reference of the pin layout as well (all Wirelings have the same pin connector order of GND, 3V3, SCL, SDA, INT): https://tinycircuits.com/collections/wireling-input-output/products/0-1-breakout-i2c-wireling
I know I answered this over email, but I thought I would copy the response here if anyone else runs into the same question:
The digital hall sensor relies on an analog pin rather than an I2C (SDA/SCL) connection. So the three pins you would need to connect are A0, GND, and 3.3V. Then you could use this code example that I have modified from what’s available in the tutorial(https://learn.tinycircuits.com/Wirelings/Hall-Effect_Wireling_Tutorial/#digital-hall-effect-wireling):
Code: [Select]
#define magPin A0 // Corresponds to PORT# of Wireling used (Do not use A0)
bool hallOutput = 0; // What is directly output from Wireling
bool magnetDetected = 0; // Make sense of output
void setup() {
Serial.begin(9600);
// Set Hall Switch Pin to input
pinMode(magPin, INPUT);
}
void loop() {
hallOutput = digitalRead(magPin); // If no magnet, hallOutput == 1
magnetDetected = !hallOutput; // Flip the hallOutput so magnetDetected == 1 when there is a magnet
Serial.println(magnetDetected);
}
For the three pins you would need to connect to the Arduino Uno (GND, 3V3,INT), you can look at the diagram in this tutorial: https://tinycircuits.com/blogs/learn/make-your-own-wireling-using-a-wireling-cable
The Breakout Wireling is a great quick reference of the pin layout as well (all Wirelings have the same pin connector order of GND, 3V3, SCL, SDA, INT): https://tinycircuits.com/collections/wireling-input-output/products/0-1-breakout-i2c-wireling