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

Thread: Where do i find the digitalwritefast library

  1. #1
    Junior Member
    Join Date
    Jan 2019
    Posts
    6

    Where do i find the digitalwritefast library

    Hi guys, i'm a bit new to this, but i've been reading about the digitalwritefast. My teensy just arrived today, and after installing everything it didn't seem to come with this library? I've looked around but is there an 'official version' somewhere that i cant find?

    Thanks
    Jason

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,578
    Welcome and congrats on the new Teensy! All the libraries are put in place after the IDE is installed then Running the TeensyDuino installer.

    If you have a supported release build of the IDE ( not the Windows App version ) - then get the Teensy Installer from the PJRC.com website and run it pointing to that install, that is a 'native' or core function included in the Teensy build process, it is not an external or separate library.

    Are you on Windows or Mac, Linux? What Teensy did you get?

  3. #3
    Junior Member
    Join Date
    Jan 2019
    Posts
    6
    Thanks! I can see where it gets its name from now, it really is tiny haha. I got the 3.6

    I did do the teensy install to the arduino IDE today and it downloaded a heap of library's with it, it seems to work and i wrote some codes and uploaded them, I just noticed that digitalwritefast wasn't one of the librarys included.

    After you said it was native, I just did a test in the IDE with the leonardo selected and wrote digitalWriteFast(), didnt do anything, changed to board to teensy and writing turned orange good to go haha.

    Another question, is there any official info on how to use it? It doesn't seem to be on this page https://www.pjrc.com/teensy/td_digital.html

    Its on windows.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,243
    Quote Originally Posted by Dulz View Post

    Another question, is there any official info on how to use it?
    There probably should be info on that old page, but isn't.

    Really, the main issue with digitalWriteFast(), especially on Teensy 3.6, is it can be too fast for the default pin config which has slew rate limiting, if you change the pin as fast as possible without any delays. Other than that minor gotcha, it's really pretty simple, the same as regular digitalWrite, but faster.

  5. #5
    Junior Member
    Join Date
    Jan 2019
    Posts
    6
    So what about pin numbers? Can you give an example if i want to change this to digitalWriteFast:

    int testPin = 3;

    digitalWrite(testPin, HIGH);

    Jason

  6. #6
    Junior Member
    Join Date
    Jan 2019
    Posts
    6
    Seems to work, changed the int to a #define testPin 3 and somethings happening

  7. #7
    Junior Member
    Join Date
    Jan 2019
    Posts
    6
    Hi Guys, i have another question, i have a pretty big i2c LCD screen 20 x 4, and it needs more power than my arduino could supply connected to the computer. So i used a usb to ttl adapter plugged into a phone charger, and hooked the 5v and ground to the screen, and hooked SDA and SCL to the arduino. It didn't work, i had to also connect the ground from the screen to the arduino, then it worked.

    My question is, i want to try it on the teensy, but can i hook the ground to the teensy without blowing it up?

    Jason

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,243
    Quote Originally Posted by Dulz View Post
    My question is, i want to try it on the teensy, but can i hook the ground to the teensy without blowing it up?
    Three possible answers:

    1: If it didn't blow up your Arduino board, it *probably* won't blow up your Teensy either. Electrically, Teensy & Arduino are pretty similar.

    2: Usually when connecting stuff together, everything needs a common ground connection. But there are some notable exceptions to this general rule.

    3: How do you imagine anyone could accurately answer a question about connecting an unknown display (other than it uses I2C and is 20x4 size), connected to an unknown "usb to ttl adapter" (maybe that's a USB serial adaptor?) and an unknown phone charger? We can't see this stuff. We're not psychic or clairvoyant.

    These imprecise words that could mean lots of different products!

    Even if we did know exactly which devices you have, we still can't see exactly how you're making the connections. All we know is "also connect the ground from the screen to the arduino".

  9. #9
    Junior Member
    Join Date
    Jan 2019
    Posts
    6
    Sorry i was pretty tired last night..

    The screen is this one, but they soldered an i2c module to the back. They told me the arduino running off computers usb port was not enough power to run it, which appeared to be correct.
    https://www.ebay.com.au/itm/Larger-2...=1589991235009

    This is the usb to ttl cable.

    https://www.ebay.com.au/itm/USB-To-R...=2098221743017

    I plugged this cable into a 5v 2amp samsung phone charger. (The type that you plug a usb cable into)

    The 5v and ground from this cable went to a breadboard.

    From the breadboard i connected the 5v to arduino uno vin and to the screens vcc.

    Also from the breadboard i connected the ground to arduinos ground pin, and to ground on the screen.

    Then i connected sda and scl to the arduino.

    It worked.

    I found if the arduino was connected to the computer i didnt need to have the 5v from the breadboard to the arduino for everything to work. It wouldnt work if i disconnected the ground from breadboard to arduino though.

    So to switch to the teensy 3.6, it seems like it would need the 5v and ground connected to work, (which seems ok?) But then i didnt know whether the sda and scl would be running at 5v which the teensy couldnt handle? This is my first i2c device so not to sure and not real confident hooking the teensy up without some expert advice

    Jason

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,243
    Ah, this is the first mention of *which* Teensy.

    Yes, Teensy 3.6 is not capable of handling 5V signals. If the display's I2C signals are 5V, which you can check by just powering up the display alone and use a voltmeter to measure the SDA or SCL voltage, then you'll need a bidirectional level shifter to convert the signals between 5V to 3.3V.

Posting Permissions

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