I’m having issues looking for some information to help me with a setup I want to make.
Put simply I want a a button membrane with each individual button to display something different on the LED display with a separate button to initiate the selection. I’ve never worked with i2c devices before and I’m thinking it is possible to output a set number (for this it’ll be 60, 90, 120) but having troubles working it all out.
So you’ll press one on the membrane and ‘60’ will be displayed, another button would then begin that timer to perform a certain function. Does this sound doable?
The system will be activating a solenoid. So here is the low down:
4 button membrane keypad for selecting a time delay.
LED display (the DFR0645) for showing the time delay selected.
An initiation button for starting the delay (or just to straight up initiate the solenoid, the one option on the keypad.
Power source that will power the nano (needed for size) and solenoid separately (with a transistor or relay to switch power to the solenoid).
I’ve done some coding before but will need to learn as I go (which is a good thing) however I’m just not sure on the I2C part of it. So far I’m aware of including such things as wire.h and some other commands and I figure I’ll be doing some code to monitor button presses and if/else statements to display the right time delay on the segment display.
I pretty much have all the components (other than a stinking mini USB to plug in to the PC haha
I’ll let Liam know and see what ideas he had in mind for your project when he’s in. Although, if you’re looking for a power supply, as well as a way to control the solenoid, as long as the draw and voltage aren’t higher than the listed limits, the L298 can take the appropriate input for your solenoid, while also providing a regulated 5V output that you can use for your Nano to power it rather than having to use a separate supply.
I may be ‘preaching to the converted’, but the other thing is to take a ‘structured’ look at coding and divide the job into bits you can work on.
handle button presses
convert them (do some processing) e.g.
a) set the time to 60, 90 or 120 seconds
b) display the time
… other stuff
operate the relay (use your operate button)
go back and wait for the next button.
since you’re concerned about the IIC and display, use their example to print different times and wait 1 second between displaying them. Then change that code to only change the time when you press a button. then add the relay operation, tidy up the code, make sure the times you set are OK for what you want, document how it works…
Let us know if you need any help with the code your writing to do this Jake, we’ll be in touch if you need anything. Depending on the microcontroller you’re using we’ve got a few workshops free and available on the site if you need any pointers on the syntax of a particular language or how to use the different devices together.