diff options
Diffstat (limited to 'Arduino')
-rwxr-xr-x | Arduino/ButtonMatrix/ButtonMatrix.pde | 28 | ||||
-rw-r--r-- | Arduino/LEDMatrix/LEDMatrix.pde | 34 | ||||
-rwxr-xr-x | Arduino/Libraies/AS1107/AS1107.h | 6 |
3 files changed, 65 insertions, 3 deletions
diff --git a/Arduino/ButtonMatrix/ButtonMatrix.pde b/Arduino/ButtonMatrix/ButtonMatrix.pde index 6ce18f4..1ed494c 100755 --- a/Arduino/ButtonMatrix/ButtonMatrix.pde +++ b/Arduino/ButtonMatrix/ButtonMatrix.pde @@ -3,6 +3,14 @@ const byte ROWS = 19; const byte COLS = 8; + +// these constants describe the pins for the acellarometer . They won't change: +const int groundpin = 18; // analog input pin 4 -- ground +const int powerpin = 19; // analog input pin 5 -- voltage +const int xpin = A3; // x-axis of the accelerometer +const int ypin = A2; // y-axis +const int zpin = A1; // z-axis (only on 3-axis models) + /* Each of the buttons can be refered to by a number At the moment the byte overflow for the 127+ numbers is dealt with at the getKey time, but if a unsigned byte could be used here it would remove the need @@ -33,6 +41,14 @@ void setup(){ Serial.begin(115200); Serial.println("Go"); + // Provide ground and power by using the analog inputs as normal + // digital pins. This makes it possible to directly connect the + // breakout board to the Arduino. If you use the normal 5V and + // GND pins on the Arduino, you can remove these lines. + pinMode(groundpin, OUTPUT); + pinMode(powerpin, OUTPUT); + digitalWrite(groundpin, LOW); + digitalWrite(powerpin, HIGH); } /* Send numbers back and forth to test the integrity of the serial communication Computer sends the first byte @@ -58,4 +74,16 @@ void loop(){ if (customKey != NO_KEY){ Serial.println(customKeyInt); } + + // print the sensor values: + Serial.print(analogRead(xpin)); + // print a tab between values: + Serial.print("\t"); + Serial.print(analogRead(ypin)); + // print a tab between values: + Serial.print("\t"); + Serial.print(analogRead(zpin)); + Serial.println(); + // delay before next reading: + delay(100); } diff --git a/Arduino/LEDMatrix/LEDMatrix.pde b/Arduino/LEDMatrix/LEDMatrix.pde new file mode 100644 index 0000000..0d3994b --- /dev/null +++ b/Arduino/LEDMatrix/LEDMatrix.pde @@ -0,0 +1,34 @@ +// test program for three cascaded AS1107 +// if you got a different configuration you need to +// modify the library itself. + +#include <AS1107.h> + +// Arduino pins +const byte CsnPin = 2 ; // Chip select (Low active) +const byte ClkPin = 3 ; // Serial Clockq +const byte DataPin = 4 ; // Serial Data + +byte buffer [ 8 ] ; // Screen buffer (No. of modules * 8) +AS1107 matrix ( CsnPin, ClkPin, DataPin ) ; + +const byte d = 0 ; +int count= 1 ; +void setup ( ) +{ + matrix. Init ( buffer, 7, 7, 0 ) ; +} + +void loop ( ) +{ + for (int x=0; x<8; x++) { + for (int y=0; y<8; y++) { + matrix.SetLed(x,y,1); + matrix.Update(); + delay(1000); + matrix.SetLed(x,y,0); + matrix.Update(); + delay(1000); + } + } +} diff --git a/Arduino/Libraies/AS1107/AS1107.h b/Arduino/Libraies/AS1107/AS1107.h index 60ad6ad..80b01da 100755 --- a/Arduino/Libraies/AS1107/AS1107.h +++ b/Arduino/Libraies/AS1107/AS1107.h @@ -59,9 +59,9 @@ class AS1107 // ***************************************
// Set your module configuration here
// ***************************************
- static const byte Maxx=15; // maximum x - Pixels of the Module
- static const byte Maxy=7; // maximum y - Pixels of the Module
- static const byte HighestCtrlNum=1; // Number of Matrix modules -1 (0 = single module)
+ static const byte Maxx=8; // maximum x - Pixels of the Module
+ static const byte Maxy=19; // maximum y - Pixels of the Module
+ static const byte HighestCtrlNum=5; // Number of Matrix modules -1 (0 = single module)
private:
byte _cspin;
|