Hi Everyone,
Newbie to learning bit level coding here. I am using the Arduino IDE to code.
I was able to get blinky to work with my Teensy 2.0 using the code specified below. I can't even begin to describe how thrilled I was when I was able to get this code to work!!!
Now I am trying to accomplish the equivalent with my Teensy 3.1, and the onboard LED is now on bit 5 of Port C so I changed my code (as specified below the Teensy 2.0 code), and I get the error " '_delay_ms' was not declared in this scope" so I suspect that the header file that I am specifying is not recognizing the _delay_ms(); function.
Can anyone please help? As a means of troubleshooting directory issues, I saved the file in the Arduino installation folder (i.e. C:\Program Files (x86)\Arduino) but I really don't want to get into the habit of this. Also, the resulting compilation in the Arduino IDE left a C file instead, and the setup() function is no longer there but the DDRD |= (1 << 6); is but just as a global variable, but the loop() function is still there.
Thank you : ) labRat
Teensy 2.0 code:
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "print.h"
void setup(){
DDRD |= (1 << 6);
}
void loop() {
PORTD = 0b01000000;//Atmega chip on board has 8-bit registers
_delay_ms(1000);
PORTD = 0b00000000;//Atmega chip on board has 8-bit registers
_delay_ms(100);
}
Teensy 3.1 code:
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <delay.h>
#include "print.h"
void setup(){
DDRC |= (1 << 5);
}
void loop() {
PORTC = 0b00100000;//
_delay_ms(100);
PORTC = 0b00100000;
_delay_ms(100);
}
Newbie to learning bit level coding here. I am using the Arduino IDE to code.
I was able to get blinky to work with my Teensy 2.0 using the code specified below. I can't even begin to describe how thrilled I was when I was able to get this code to work!!!
Now I am trying to accomplish the equivalent with my Teensy 3.1, and the onboard LED is now on bit 5 of Port C so I changed my code (as specified below the Teensy 2.0 code), and I get the error " '_delay_ms' was not declared in this scope" so I suspect that the header file that I am specifying is not recognizing the _delay_ms(); function.
Can anyone please help? As a means of troubleshooting directory issues, I saved the file in the Arduino installation folder (i.e. C:\Program Files (x86)\Arduino) but I really don't want to get into the habit of this. Also, the resulting compilation in the Arduino IDE left a C file instead, and the setup() function is no longer there but the DDRD |= (1 << 6); is but just as a global variable, but the loop() function is still there.
Thank you : ) labRat
Teensy 2.0 code:
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "print.h"
void setup(){
DDRD |= (1 << 6);
}
void loop() {
PORTD = 0b01000000;//Atmega chip on board has 8-bit registers
_delay_ms(1000);
PORTD = 0b00000000;//Atmega chip on board has 8-bit registers
_delay_ms(100);
}
Teensy 3.1 code:
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <delay.h>
#include "print.h"
void setup(){
DDRC |= (1 << 5);
}
void loop() {
PORTC = 0b00100000;//
_delay_ms(100);
PORTC = 0b00100000;
_delay_ms(100);
}