Added a song text onto the screen.

This commit is contained in:
Andrew Lalis 2017-02-17 11:26:59 +01:00
parent 53bbd3368a
commit 22d6346c04
3 changed files with 19 additions and 13 deletions

View File

@ -41,6 +41,7 @@ U8X8_SSD1306_128X64_NONAME_4W_SW_SPI screen(OLED_CLK, OLED_MOSI, OLED_CS, OLED_D
#define IN_mode 17
#define IN_left 18
#define IN_right 19
#define MODE_MAX 2
//Global variables
//Shift register buffer.
@ -55,10 +56,8 @@ unsigned long blinkerLeftLastUpdate = 0;
//Input control variables
//Mode control button.
char mode = 0;
bool modePressed = 0;
unsigned long modePressedTime = 0;
bool leftPressed, rightPressed = 0;
unsigned long leftPressedTime, rightPressedTime = 0;
bool modePressed, leftPressed, rightPressed = 0;
unsigned long modePressedTime, leftPressedTime, rightPressedTime = 0;
//Music variables.
short BPM, noteDuration;
short* currentSequence;
@ -68,9 +67,9 @@ unsigned long noteEndTime;
short beep1[] = {
3, 100,
NOTE_A4, 4,
NOTE_E7, 4,
NOTE_C2, 4
NOTE_A4, 2,
NOTE_E6, 2,
NOTE_C8, 2
};
short skyrim[] = {
@ -201,6 +200,8 @@ void drawMainScreen() {
writeText("+-+-+-+-+------+", 0, 1);
writeText("|L|R|F|B|Mode:0|", 0, 2);
writeText("+-+-+-+-+------+", 0, 3);
writeText("|Song: |", 0, 4);
writeText("+--------------+", 0, 5);
}
//Draws the blinker indicators to the screen.
@ -333,11 +334,11 @@ void updateInputs() {
//Mode button was pressed.
modePressed = 1;
modePressedTime = currentTime;
if (mode == 0) {
mode = 1;
if (mode == MODE_MAX) {
mode = 0;
}
else {
mode = 0;
mode++;
}
drawModeStatus();
//Serial.println("Mode pressed.");
@ -522,7 +523,7 @@ void setup() {
startupScreen();
drawMainScreen();
updateAll();
playSequence(skyrim);
playSequence(beep1);
}
void loop() {

View File

@ -47,7 +47,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\Users\AndrewComputer\Documents\Arduino\libraries\U8g2\src;D:\Arduino\hardware\arduino\avr\libraries\SPI\src;D:\Arduino\hardware\arduino\avr\libraries\Wire\src;C:\Users\AndrewComputer\Documents\Arduino\libraries\U8g2\src\utility;D:\Arduino\hardware\arduino\avr\libraries\Wire\src\utility;D:\Arduino\libraries;D:\Arduino\hardware\arduino\avr\libraries;C:\Users\AndrewComputer\Documents\Arduino\libraries;D:\Arduino\hardware\arduino\avr\cores\arduino;D:\Arduino\hardware\arduino\avr\variants\eightanaloginputs;C:\Users\AndrewComputer\Documents\Arduino\BicycleControl;D:\Arduino\hardware\tools\avr/avr/include/;D:\Arduino\hardware\tools\avr//avr/include/avr/;D:\Arduino\hardware\tools\avr/lib\gcc\avr\4.8.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Users\AndrewComputer\Documents\Arduino\libraries\U8g2\src;D:\Arduino\hardware\arduino\avr\libraries\SPI\src;D:\Arduino\hardware\arduino\avr\libraries\Wire\src;D:\Arduino\hardware\arduino\avr\libraries\SPI\src\utility;C:\Users\AndrewComputer\Documents\Arduino\libraries\U8g2\src\utility;D:\Arduino\hardware\arduino\avr\libraries\Wire\src\utility;D:\Arduino\libraries;D:\Arduino\hardware\arduino\avr\libraries;C:\Users\AndrewComputer\Documents\Arduino\libraries;D:\Arduino\hardware\arduino\avr\cores\arduino;D:\Arduino\hardware\arduino\avr\variants\eightanaloginputs;C:\Users\AndrewComputer\Documents\Arduino\BicycleControl;D:\Arduino\hardware\arduino\avr\cores\arduino;D:\Arduino\hardware\arduino\avr\variants\eightanaloginputs;C:\Users\AndrewComputer\Documents\Arduino\libraries\U8g2\src;D:\Arduino\hardware\arduino\avr\libraries\SPI\src;D:\Arduino\hardware\arduino\avr\libraries\Wire\src;D:\Arduino\libraries;D:\Arduino\hardware\arduino\avr\libraries;D:\VisualStudio\Common7\IDE\Extensions\g5m1xwby.5un\Micro Platforms\default\debuggers;C:\Users\AndrewComputer\Documents\Arduino\libraries;D:\Arduino\hardware\tools\avr/avr/include/;D:\Arduino\hardware\tools\avr//avr/include/avr/;D:\Arduino\hardware\tools\avr/lib\gcc\avr\4.8.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>C:\Users\AndrewComputer\Documents\Arduino\BicycleControl\__vm\.BicycleControl.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
<PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;F_CPU=16000000L;ARDUINO=106012;ARDUINO_AVR_NANO;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -21,8 +21,13 @@
<ClInclude Include="__vm\.BicycleControl.vsarduino.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Pitches.h">
<ClInclude Include="Musical.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Musical.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>