Hi All,
I decided to try my hand at my first solo project after going through a chunk of the tutorials.
I also decided to share it with you all, dont laugh I know its crap but its my first go.
Plus if anyone has any tips, tricks, tweaks or advice id be happy to listen.
#include <ks0108.h>
#include <Arial14.h>
#include "SystemFont5x7.h"
#include "DICE/ONE.h"
#include "DICE/TWO.h"
#include "DICE/THREE.h"
#include "DICE/FOUR.h"
#include "DICE/FIVE.h"
#include "DICE/SIX.h"
int number;
int button;
void setup(){
pinMode(42, INPUT);
GLCD.Init(NON_INVERTED);
GLCD.SelectFont(System5x7);
GLCD.ClearScreen();
GLCD.CursorTo(0, 2);
GLCD.Puts("Press the button");
GLCD.CursorTo(0, 4);
GLCD.Puts("to roll the dice.");
}
void loop(){
number = random(1, 7);
button = digitalRead(42);
if (button == 1){
GLCD.ClearScreen();
if (number == 1)
{
GLCD.DrawBitmap(ONE, 0,0, BLACK);
}
if (number == 2)
{
GLCD.DrawBitmap(TWO, 0,0, BLACK);
}
if (number == 3)
{
GLCD.DrawBitmap(THREE, 0,0, BLACK);
}
if (number == 4)
{
GLCD.DrawBitmap(FOUR, 0,0, BLACK);
}
if (number == 5)
{
GLCD.DrawBitmap(FIVE, 0,0, BLACK);
}
if (number == 6)
{
GLCD.DrawBitmap(SIX, 0,0, BLACK);
}
delay(5000);
GLCD.ClearScreen();
GLCD.CursorTo(0, 1);
GLCD.Puts("Press the button");
GLCD.CursorTo(0, 3);
GLCD.Puts("to roll the dice.");
}
}