Joseph Taylor
After getting the Arduino SIM Card Module working, I decided to put it to good use.
Here is a sketch I wrote that sends most of the lyrics from Rick Astley – Never Gonna Give You Up to a number of choice. It takes about 2 minutes to execute.
Enjoy!
//Include the required libraries
#include
#include
//Specify the SIM card module's software serial pins
SoftwareSerial SIM900(7, 8);
//Set the phone number
unsigned long phoneNumber = 700456456; //Exclude +447
//Set how much of the lyrics should be sent
int sendCount = 3; //There are 34 strings in the SMS Rickroll
//Store the lyrics
char* myStrings[] = {"We're no strangers to love", "You know the rules and so do I", "A full commitment's what I'm thinking of",
"You wouldn't get this from any other guy", "I just want to tell you how I'm feeling",
"Gotta make you understand", "Never gonna give you up, never gonna let you down",
"Never gonna run around and desert you", "Never gonna make you cry, never gonna say goodbye",
"Never gonna tell a lie and hurt you", "We've known each other for so long",
"Your heart's been aching but you're too shy to say it", "Inside we both know what's been going on",
"We know the game and we're gonna play it", "And if you ask me how I'm feeling",
"Don't tell me you're too blind to see", "Never gonna give you up, never gonna let you down",
"Never gonna run around and desert you", "Never gonna make you cry, never gonna say goodbye",
"Never gonna tell a lie and hurt you", "Never gonna give you up, never gonna let you down",
"Never gonna run around and desert you", "Never gonna make you cry, never gonna say goodbye",
"Never gonna tell a lie and hurt you", "We've known each other for so long",
"Your heart's been aching but you're too shy to say it", "Inside we both know what's been going on",
"We know the game and we're gonna play it", "I just want to tell you how I'm feeling",
"Gotta make you understand", "Never gonna give you up, never gonna let you down",
"Never gonna run around and desert you", "Never gonna make you cry, never gonna say goodbye",
"Never gonna tell a lie and hurt you"
};
void setup()
{
//Start the software serial for communication with the SIM card module
SIM900.begin(19200);
//Start serial communication for interfacing with your PC
Serial.begin(19200);
delay(500);
}
void loop()
{
//Check if the letter 't' is sent in the Serial Monitor and initiate the Rickroll
if (Serial.available())
switch (Serial.read())
{
case 't':
Serial.print("Mobile number: +44(0)7");
Serial.print(phoneNumber);
Serial.print("\n");
Serial.print("Now Playing: Rick Astley - Never Gonna Give You Up \n");
SendTextMessage();
break;
}
}
void SendTextMessage()
{
//Repeat the Rickrolling process until the sendCount value has been reached
for (int i = 0; i < sendCount; i++) {
SIM900.print("AT+CMGF=1\r");
delay(100);
SIM900.print("AT + CMGS = \"+447");
delay(100);
SIM900.print(phoneNumber);
delay(100);
SIM900.println("\"");
delay(100);
SIM900.println(myStrings[i]);
delay(100);
SIM900.println((char)26);
delay(100);
SIM900.println();
delay(2000);
Serial.print(myStrings[i]);
Serial.print("\n");
delay(2000);
}
}
The next step is to make a web interface that connects to the Arduino to allow anyone to Rickroll their friends. Maybe it's not such a good idea, but what's stopping me doing it for proof of concept?
If you have any questions about this project, or any others on my site get in touch!