Teensy Blink on Teensy 1.0

Markus_L811

Well-known member
Hello,

on my own I'm a huge fan of the Blink example. So I did my part on it and make it more comfortable for me, code below.

Code:
/* LED Blink, Teensyduino Tutorial #1
   http://www.pjrc.com/teensy/tutorial.html
 
   This example code is in the public domain.
*/

// Teensy 2.0 has the LED on pin 11
// Teensy++ 2.0 has the LED on pin 6
// Teensy 3.0 has the LED on pin 13
#if defined(__MK20DX128__) || defined(__MK20DX256__)
         //  Teensy 3.0                Teensy 3.1
  #define ledPin 13
#elif defined (__AVR_ATmega32U4__)
         //     Teensy 2.0
  #define ledPin 11
#elif defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
         //    Teensy 1.0                     Teensy 1.0++                   Teensy 2.0++                    
  #define ledPin  6
#else
  #define ledPin 13
#endif

//const int ledPin = Pin;

int timing = 125;

// the setup() method runs once, when the sketch starts

void setup() {
  // initialize the digital pin as an output.
  pinMode(ledPin, OUTPUT);
}

// the loop() methor runs over and over again,
// as long as the board has power

void loop() {
  digitalWrite(ledPin, HIGH);   // set the LED on
  delay(timing);                  // wait for a second
  digitalWrite(ledPin, LOW);    // set the LED off
  delay(timing);                  // wait for a second
}

So I tested it on Arduino IDE 1.0.5 with Teensyduino 1.18RC all works fine except for Teensy 1.0 there I get this:

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.5 (Windows 7), Board: "Teensy 1.0"
C:\Users\HP\AppData\Local\Temp/ccPO5Vzc.s: Assembler messages:
C:\Users\HP\AppData\Local\Temp/ccPO5Vzc.s:198: Error: illegal opcode mul for mcu at90usb162
C:\Users\HP\AppData\Local\Temp/ccPO5Vzc.s:203: Error: illegal opcode mul for mcu at90usb162
C:\Users\HP\AppData\Local\Temp/ccPO5Vzc.s:207: Error: illegal opcode mul for mcu at90usb162
C:\Users\HP\AppData\Local\Temp/ccPO5Vzc.s:211: Error: illegal opcode mul for mcu at90usb162
C:\Users\HP\AppData\Local\Temp/ccPO5Vzc.s:237: Error: illegal opcode mul for mcu at90usb162

On Arduino IDE 1.0.4 with Teensy 1.14RC2 it compiled fine. So what did I do wrong?
 

Attachments

  • Blink_with_benefits.ino
    1.2 KB · Views: 146
Last edited:
I don't know where the error messages came from but you can remove all the ifdef stuff and replace it with:
Code:
#define ledPin LED_BUILTIN

Pete
 
Back
Top