Clock β

Time to wake up! Turn your Hedgehog Bot into a runaway alarm clock and learn some more about how your Hedgehog Bot works.

Language
C++
Est. Time
60—120min
Difficulty
Tricky

Requires a PC and a Hedgehog Bot

If you've not built a Hedgehog Bot, complete the Bot challenge. You'll also need a microUSB cable.

This workshop is in beta

It may be a little rough around the edges: tweet us if there's any issues.
  1. Download and unzip the starter template

    Download from GitHub

  2. Tidy up

    If you’re using Arduino IDE, copy the folders inside lib/ to your Arduino libraries folder (on Windows, usually Documents\Arduino\libraries). You don’t need to do this if you’re using a PlatformIO-compatible IDE such as Visual Studio Code.

    In Windows 8.1, your default Documents folder may be in OneDrive. For more troubleshooting, see setup.

  3. Open src/src.ino in Arduino IDE

    You can also open the top folder in any PlatformIO-compatible IDE (such as Visual Studio Code + the PlatformIO IDE extension - recommended), and start in src/hh_clock.cpp. There’s instructions on setting up Visual Studio Code in the first challenge - just skip downloading and opening the starter workspace for that workshop.

  4. Follow the instructions, and complete the TODOs, from there

    • Your hedgehog should try and connect to WiFi

    • If you see ‘Connection Failed’, check your network’s SSID and passphrase (TODO #2)

    • After connecting to the NTP server (check TODOs #4 & #5 if you don’t see ‘Getting time’ flash up, and your hedgehog freezes) you should see the current time

    • After a second, the alarm icon and alarm time will change to a signal icon and an IP address…

    • …you can type this into your web browser to change the alarm or time zone! If it doesn’t work, check TODO #13

    • When the alarm rings, your hedgehog will dance and the screen will flash! Check TODO #6 if it doesn’t, and TODO #7 to make it dance as you’d like!

    • Press RESET on the WeMos to stop the alarm. Check TODO #12 if it keeps ringing, and check TODOs #3 & #8-11 if it resets your alarm and timezone, and/or shows 00:00.

  1. Challenge Complete!

    You should now know a bit about network time protocol, writing a program using multiple files, namespaces, classes, structs and enums.