top of page
Writer's picturenmjcairns

Getting Bluetooth to Work? Button Issues?

After weeks of trying I finally managed to connect my two Arduino boards using Bluetooth! I'm still experimenting showing the data from one board on the other but I'm happy with getting them to finally connect.


One step forward, two steps back? While getting another element working, there is an issue in another, my board and code does not appreciate the use of the button...


The colour sensor displaying on the neopixel works, but adding a button to turn on/off the sensor has been challenging. An if statement telling the sensor only to take readings if the button is press is not working in a typical way right now. In theory, the button should turn on and off the built-in led within the colour sensor preventing it from taking readings. However the issue is if the colour sensors led is turned off and on it refuses to take readings.


How it's meant to work: Button is pressed, since it is pressed it turns on the colour sensors led allowing to take readings, the code checks colour (taking the readings) and sends off data, shows the colour values via the neopixel, once button is released/repressed it turns the led off.


Since it wasn't working I played around with it seeing what would happen if I switched what pin the button can control, changing it between the SDL and SDA pins, this should not have made a difference to how the code functions. All it changed was rather than turning on/off the led it turned on/off those pins without interrupting the led. Something happened what I didn't expect, I tried the sensor, it didn't work. I pressed the button to turn on the sensors pin and the sensor began taking and displaying readings... This is odd, it wasn't meant to work, typically it would be the led that is meant get controlled for the control of the sensor. Neither myself or Ali have been able to figure this part out as of yet, so I'm continuing to experiment with it until I can figure something out.


3 views0 comments

Recent Posts

See All

Branding

Comments


bottom of page