About SPICE |
SPICE Basics |
Running SPICE |
CIRCUIT COLLECTION
SPICE Commands |
SPICE Downloads |
About |
Contact |
Home
This code builds on our Initial Test Software by adding a pushbutton press to change the Vrange. Again, even though we have NO analog prototype built yet, we can still write code and run a basic PRE-TEST with the Arduino UNO Board by itself.
Check out the Software Design overview.
Back to Design Series
Here's the fast track version of running a C program (sketch) on your Arduino Board.
The schematic shows the physical world that the code controls to implement our meter.
To out initial test flow, we've added the blocks to Read Pushbutton and change Vrange.
A pushbutton as digital input requires only one additional component, a
pullup resistor.
The two states can be described as
SW Vdin Digital
Open 5V logic 1
Closed 0V logic 0
You read the button state every trip through the loop() function (or 0.25s) using digitalRead(Dx). The present and last reading are stored in variables
Although Normally Open, a press of the button causes a logic transition from 1 to 0. You can easily detect this change with the conditional statement
Arduino Pin usage
Again, this section describes the added function of the pushbutton to our initial test code. The goal is fairly straighforward to create some reasonable code. However, I'm open to any suggestions from those with more Software experience.
The variable declararions occur before the setup() function.
This code excecutes once in the Arduino Sketch. The digital bit D11 has been added as an input to read the state of the Pushbutton.
This code runs continuously. Here's the added code that looks for a 1 to 0 transition on the pushbutton state. See comments in gray for description.
What can we test even though the analog circuitry has NOT been prototyped? Yes you can jumper digital input D11 to GND or leave OPEN for a digital state of 0 or 1.
The phase of software coding led to design improvement! While looking at Arduino code examples and documentation, I noticed an option for the pinMode() statement for an internal pull-up resistor option.
Congratulations for travelling this far, the basic voltmeter code is complete! However, in order to fully test it, we'll need to start constructing the actual prototype..
Back to Design Series