Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: "Digital Input/Output" webpage needs a refresh?

  1. #1
    Junior Member
    Join Date
    Jul 2015
    Location
    Edinburgh, Scotland
    Posts
    3

    "Digital Input/Output" webpage needs a refresh?

    Hi there,

    I'm trying to bring up a new project on Teensyduino and I was trying to use the webpage here:

    https://www.pjrc.com/teensy/td_digital.html

    The page says:

    You can control the mode of any pin using the pinMode() function. For example:
    Code:
      pinMode(PIN_D6, OUTPUT);
    but it looks like this page only applies to Teensy < 3.0 - when I try that specific code in an otherwise empty project for Teensy 3.1:

    Code:
    void setup() {
      // put your setup code here, to run once:
      pinMode(PIN_A1, OUTPUT);
    
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    
    }
    I get the following error:

    Code:
    Arduino: 1.6.5 (Linux), TD: 1.24, Board: "Teensy 3.1, Serial, 96 MHz optimized (overclock), US English"
    
    Build options changed, rebuilding all
    
    /home/gareth/tools/arduino-1.6.5/hardware/tools/arm/bin/arm-none-eabi-g++ -c -O -g -Wall -ffunction-sections -fdata-sections -MMD -nostdlib -fno-exceptions -felide-constructors -std=gnu++0x -fno-rtti -mthumb -mcpu=cortex-m4 -D__MK20DX256__ -DTEENSYDUINO=124 -DARDUINO=10605 -DF_CPU=96000000 -DARDUINO_ARCH_AVR -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/gareth/tools/arduino-1.6.5/hardware/teensy/avr/cores/teensy3 /tmp/build2195455312139044899.tmp/sketch_jul01b.cpp -o /tmp/build2195455312139044899.tmp/sketch_jul01b.cpp.o 
    sketch_jul01b.ino: In function 'void setup()':
    sketch_jul01b.ino:3:11: error: 'PIN_A1' was not declared in this scope
    'PIN_A1' was not declared in this scope
    Digging into the header files in arduino-1.6.5/hardware/teensy/avr/cores shows that the pins are only defined in the PIN_nn syntax for the teensy/ core, not teensy3/.

    Does that page need an update for 3.0/3.1? Could it be at least flagged at the top as incorrect for 3.0 and 3.1 to save some time for others?

    Cheers
    Gareth
    Last edited by gde; 07-01-2015 at 07:14 PM. Reason: Change to a more relevant pin

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Location
    Boston, MA, USA
    Posts
    1,108
    It does need an update, yes.

    Use the Arduino pin numbers (just the number for digital pins, A plus a number for analog pins), not the ancient PIN_* syntax. You can find the pin numbers on the [url=http://www.pjrc.com/teensy/pinout.html]pinout page]. For example you could refer to the pin which connects to port D6 on Teensy 2.0 as "11" or as "A10".

  3. #3
    Junior Member
    Join Date
    Jul 2015
    Location
    Edinburgh, Scotland
    Posts
    3
    Yes, I should have said I found the "A1" syntax when I dug into the headers. After having browsed around further on the forum it looks like the static content is about to be replaced/supplemented with a wiki so maybe it's moot now.

    Thanks for the reply.

    Gareth

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •