In order to view and play with the Hack Pack coding console (IDE), please visit this page on a Mac, PC, or Chromebook.
Mobile and Tablets are currently not supported (sorry!).
Bonus Content Unlocked

LASER SYNTHESIZER

synthesizer
Go behind the scenes on the LASER SYNTHESIZER, and learn how to use Serial prints in your code!
void printNoteData(){
  Serial.print("Note 1: ");
  Serial.print(midiNoteToName(generatedScale[noteSet1]));
  Serial.print(" Note 2: ");
  Serial.println(midiNoteToName(generatedScale[noteSet2]));

  Serial.print("X Axis: ");
  Serial.print(xVal);
  Serial.print(" Y Axis: ");
  Serial.println(yVal);
}

String midiNoteToName(byte midiNote) {
  const char* noteNames[] = {
    "C", "C#", "D", "D#", "E", "F",
    "F#", "G", "G#", "A", "A#", "B"
  };

  byte noteIndex = midiNote % 12;
  int octave = (midiNote / 12) - 1;  // MIDI standard: C4 = 60
  
  return String(noteNames[noteIndex]) + String(octave);
}