Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool wasWifi = false;

// Wifi Stuff
const char* ntpServer = "pool.ntp.org";
const long gmtOffset_sec = 36000;
const long gmtOffset_sec = -28800;
const int daylightOffset_sec = 3600;

// Loop states
Expand All @@ -77,20 +77,20 @@ void setup()
// Alternate I2C Address is 0x3D
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))
{
{
Serial.println("SSD1306 allocation failed - Execution halted!");
// Don't proceed, loop forever
while (1);
while (1);
}
Serial.println("SSD1306 OLED initialised");

// Initialise the LIS3DH as addreess 0x18
// Alternate I2C Address is 0x19
if (! lis.begin(0x18))
{
{
Serial.println("No LIS3DH IMU Found or failed to start - Execution halted!");
// Don't proceed, loop forever
while (1);
while (1);
}
Serial.println("LIS3DH found and initialised!");

Expand Down Expand Up @@ -128,14 +128,29 @@ void setup()

void BootSound()
{
for (int freq = 255; freq < 2000; freq = freq + 250)
{
tp.Tone( AUDIO, freq );
delay(50);
for (int freq = 255; freq < 2000; freq = freq + 250)
{
tp.Tone( AUDIO, freq );
delay(50);
}

tp.NoTone( AUDIO );
}
void ButtonSound()
{
int freq;
for (freq = 255; freq < 2000; freq = freq + 500)
{
tp.Tone( AUDIO, freq );
delay(50);
}
for (; freq > 250; freq = freq - 250)
{
tp.Tone( AUDIO, freq );
delay(50);
}
tp.NoTone( AUDIO );
}

void loop() {
// put your main code here, to run repeatedly:
Expand All @@ -154,7 +169,7 @@ void loop() {
currentState = 0;
return;
}

if ( WiFi.status() == WL_CONNECTED )
{
WiFi.disconnect(true);
Expand Down Expand Up @@ -228,15 +243,15 @@ void loop() {
display.println( "[2] Toggle IMU");
break;
case 2:
display.println( "[3] ...");
display.println( "[3] Toggle LED+Sound");
break;
case 3:
display.println( "[4] Toggle WiFi");
break;
case 99:
display.println( "ERR: SSID Not Set!");
break;

}
}

Expand Down Expand Up @@ -310,6 +325,9 @@ void Click2()
void Click3()
{
buttonStates[2] = 10;
digitalWrite( LED, !old_LED_state );
ButtonSound();
digitalWrite( LED, old_LED_state );
}

void Click4()
Expand Down