This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
digispark:tutorials:probetashield [2014/06/24 18:24] netguy204 |
digispark:tutorials:probetashield [2016/06/09 12:03] (current) |
||
|---|---|---|---|
| Line 24: | Line 24: | ||
| - | Insert resistors and capacitors as labeled - solder connection on the bottom. Trim excess leads. | + | Insert resistors as labeled - solder connection on the bottom. Trim excess leads. |
| Insert LDR in oval spot next to 10 k resistors. Solder connection on bottom. Trim excess leads. | Insert LDR in oval spot next to 10 k resistors. Solder connection on bottom. Trim excess leads. | ||
| Line 31: | Line 31: | ||
| Insert DIP socket and solder connection on bottom. | Insert DIP socket and solder connection on bottom. | ||
| + | |||
| + | Insert two 9 pin male headers from the bottom of the PCB and solder on the top - plug Digispark Pro with female headers into the bottom. | ||
| + | |||
| + | Insert capacitors as labeled (large cap is polarized '-' leg to '-' on board) - solder connection on the bottom. Trim excess leads. | ||
| Insert 8x8 LED Matrix with the black writing on the edge of the Matrix facing downward to the bottom edge of the board - NOT facing the capacitors. Solder connections. | Insert 8x8 LED Matrix with the black writing on the edge of the Matrix facing downward to the bottom edge of the board - NOT facing the capacitors. Solder connections. | ||
| Line 38: | Line 42: | ||
| Snap joystick cap on to joystick. | Snap joystick cap on to joystick. | ||
| - | Insert two 9 pin male headers from the bottom of the PCB and solder on the top - plug Digispark Pro with female headers into the bottom. | ||
| Use the LED control library to control the LED Matrix (included with the IDE addons) - use the following init string for proper pin settings: | Use the LED control library to control the LED Matrix (included with the IDE addons) - use the following init string for proper pin settings: | ||
| Line 63: | Line 66: | ||
| {{ :digispark:tutorials:6ef3983ff188369f9adc97bfb5326c4e_large.jpg?nolink |}} | {{ :digispark:tutorials:6ef3983ff188369f9adc97bfb5326c4e_large.jpg?nolink |}} | ||
| - | Here's [[https://gist.github.com/netguy204/7c336bbdbe50113b2abc|a sketch that uses all of the inputs and outputs on the board]] | + | Here's [[https://gist.github.com/netguy204/7c336bbdbe50113b2abc|a sketch that uses all of the inputs and outputs on the board]]: |
| + | |||
| + | <code> | ||
| + | #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) | ||
| + | #include <LedControl.h> | ||
| + | |||
| + | #define JOYX A5 | ||
| + | #define JOYY A8 | ||
| + | #define BUTTON 1 | ||
| + | #define LIGHT A9 | ||
| + | |||
| + | LedControl lc = LedControl(10,11,12,1); | ||
| + | |||
| + | void setup() { | ||
| + | lc.shutdown(0, false); | ||
| + | lc.setIntensity(0, 8); | ||
| + | lc.clearDisplay(0); | ||
| + | |||
| + | pinMode(JOYX, INPUT); | ||
| + | pinMode(JOYY, INPUT); | ||
| + | pinMode(BUTTON, INPUT); | ||
| + | pinMode(LIGHT, INPUT); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | lc.setIntensity(0, map(analogRead(LIGHT), 0, 1024, 0, 15)); | ||
| + | lc.clearDisplay(0); | ||
| + | if(!digitalRead(BUTTON)) { | ||
| + | for(int x = 0; x < 8; x++) { | ||
| + | for(int y = 0; y < 8; y++) { | ||
| + | lc.setLed(0, x, y, true); | ||
| + | } | ||
| + | } | ||
| + | delay(10); | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | long xint = analogRead(JOYX); | ||
| + | long yint = analogRead(JOYY); | ||
| + | |||
| + | long x = map(xint, 0, 1023, 15, 0); | ||
| + | long y = map(yint, 0, 1023, 15, 0); | ||
| + | |||
| + | if(x % 2 == 1) { | ||
| + | lc.setLed(0, (x / 2) + 1, y/2, true); | ||
| + | } | ||
| + | if(y % 2 == 1) { | ||
| + | lc.setLed(0, x/2, (y / 2) + 1, true); | ||
| + | } | ||
| + | if(x % 2 == 1 && y % 2 == 1) { | ||
| + | lc.setLed(0, (x / 2) + 1, (y / 2) + 1, true); | ||
| + | } | ||
| + | |||
| + | lc.setLed(0, x/2, y/2, true); | ||
| + | delay(10); | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | Or, [[https://github.com/netguy204/BetaInvaders/archive/master.zip|try out this simple version of Space Invaders]]. | ||
| + | |||
| + | Or, [[https://github.com/netguy204/BetaSketcher/archive/master.zip|play with an etch-a-sketch simulator]]. | ||
| + | |||
| + | Or, [[http://playground.arduino.cc/Main/LedControl|LedControl::Arduino library for the MAX7221 and MAX7219 ]]. | ||
| + | |||