Page 32 - Building the remote
Use the information below instead of the printed copy if you have Volume 12 Edition 1. We have updated the circuit and the schematics. Scroll down to find the entire code that you can copy and paste.
Code for the remote
#include <SoftwareSerial.h> SoftwareSerial mySerial(-1,1); int myled=10; #define F_CPU 8000000L #define IR_CLOCK_RATE 38000L #define pwm 3 void setup() { pinMode(myled,OUTPUT); pinMode(5,OUTPUT); OSCCAL = 135; TCNT1 = 0; TCCR1A = 0; TCCR1B = 0; TCCR1B |= _BV(WGM12); TCCR1A |= (1<<COM1B0); TCCR1B |= (1<<CS10); OCR1B = 104; OCR1A = 104; pinMode(pwm,OUTPUT); } void loop() { digitalWrite.myled,HIGH); delay(100); mySerial.print("Ahoy Captain! Turn "); mySerial.print(TCNT1); mySerial.println(" degrees North!"); digitalWrite(myled,LOW); delay(1000); }