This was a simple project meant as a lighthearted joke alluding to the humorous notion of the "Rickroll" in popular culture. The program makes use of the VEXcode playNote function which emits a sound from the VEX IQ 2nd gen Brain's built-in speaker at a frequency corresponding to the notes of the C major scale.
Although VEXcode supports playing notes at multiple octaves, there seems to be a firmware limitation in the new 2nd gen Brain that blocks this ability. Thus, the Never Gonna Give You Up tune was transposed to F major, taking F natural as the tonic note of the scale.
#include "vex.h"
using namespace vex;
unsigned const int C = 0;
unsigned const int D = 1;
unsigned const int E = 2;
unsigned const int F = 3;
unsigned const int G = 4;
unsigned const int A = 5;
unsigned const int B = 6;
void rickRoll(){
Brain.playNote(4, C, 150);
Brain.playNote(4, D, 150);
Brain.playNote(4, F, 150);
Brain.playNote(4, D, 150);
Brain.playNote(4, A, 450);
Brain.playNote(4, A, 450);
Brain.playNote(4, G, 300);
wait(600, msec);
Brain.playNote(4, C, 150);
Brain.playNote(4, D, 150);
Brain.playNote(4, F, 150);
Brain.playNote(4, D, 150);
Brain.playNote(4, G, 450);
Brain.playNote(4, G, 450);
Brain.playNote(4, F, 450);
Brain.playNote(4, E, 150);
Brain.playNote(4, D, 150);
wait(150, msec);
Brain.playNote(4, C, 150);
Brain.playNote(4, D, 150);
Brain.playNote(4, F, 150);
Brain.playNote(4, D, 150);
Brain.playNote(4, F, 500);
Brain.playNote(4, G, 300);
Brain.playNote(4, E, 450);
Brain.playNote(4, D, 150);
Brain.playNote(4, C, 150);
wait(450, msec);
Brain.playNote(4, C, 300);
Brain.playNote(4, G, 600);
Brain.playNote(4, F, 500);
}
int main() {
rickRoll();
}