Cheers for your answer. Im just trying to read normally from it at the moment, and I am getting 15 on my lcd (8+4+2+1). By checking on my multimeter, all four pins are getting 5 volts. i just wondered whether this was norm, because if I move the switch the number doesnt change from 15. i.e do I have a short, or is my wiring wrong. I have been going by this scematic:
My code is:
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
Adafruit_PCD8544 display = Adafruit_PCD8544(52, 51, 50, 48, 49);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
static unsigned char __attribute__ ((progmem)) logo16_glcd_bmp[]={
0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0xf8, 0xbe, 0x9f, 0xff, 0xf8, 0xc0, 0xc0, 0xc0, 0x80, 0x00,
0x20, 0x3c, 0x3f, 0x3f, 0x1f, 0x19, 0x1f, 0x7b, 0xfb, 0xfe, 0xfe, 0x07, 0x07, 0x07, 0x03, 0x00, };
#define q1 38
#define q2 39
#define q4 40
#define q8 41
void setup()
{
display.begin();
display.setContrast(40);
display.clearDisplay(); // clears the screen and buffer
// text display tests
display.setTextSize(2);
display.setTextColor(BLACK);
display.setCursor(0,10);
display.println("Hello World");
display.display();
delay(1000);
pinMode(q1, INPUT); // thumbwheel '1'
pinMode(q2, INPUT); // thumbwheel '2'
pinMode(q4, INPUT); // thumbwheel '4'
pinMode(q8, INPUT); // thumbwheel '8'
}
int readSwitch()
{
int total=0;
if (digitalRead(q1)==HIGH) { total+=1; }
if (digitalRead(q2)==HIGH) { total+=2; }
if (digitalRead(q4)==HIGH) { total+=4; }
if (digitalRead(q8)==HIGH) { total+=8; }
return total;
}
void loop()
{
//dispSAA1064(readSwitch()); // sends switch value to display shield
display.clearDisplay();
display.println(readSwitch()); // sends switch value to serial monitor box
display.display();
delay(200);
}
Thanks