美文网首页我爱编程
Teensy的开发环境部署及基本用法

Teensy的开发环境部署及基本用法

作者: 半个王国 | 来源:发表于2016-12-27 19:28 被阅读699次

    开发环境(Windows)


    安装 Arduino

    下载地址:https://downloads.arduino.cc/arduino-1.6.13-windows.exe

    安装 Teensyduino

    下载地址:https://www.pjrc.com/teensy/td_133/TeensyduinoInstall.exe

    基本使用


    打开ADE开发工具:Arduino Development Environment


    Paste_Image.png

    在工具菜单选择开发板,这里我选择:Teensy++ 2.0


    Paste_Image.png

    在工具菜单里选择 USB Type:Keyboard + Mouse + Joystick


    Paste_Image.png

    ADE中使用的开发语言是C,一个程序在ADE中被成为 sketch ,每个 sketch 都包含一个 setup 函数和一个 loop 函数。程序启动,首先调用 setup,这个函数只被调用一次,loop 函数会被不停的重复调用下去。

    下面我们写一个 Hello World 的程序吧:

    void setup() {
      // put your setup code here, to run once:
      Keyboard.print("Hello World");
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
      delay(2000);  // 暂停2秒
      Keyboard.print("Hello World");  // 模拟键盘输入 Hello World
    }
    

    然后点击验证按钮编译,编译通过后,连上Teensy设备,上传程序到Teensy:


    Paste_Image.png

    此时,重启Teensy,就会发现你的电脑一直在输入 “Hello World”,根本停不下来,除非你按下Teensy板卡上的圆圈按钮,或拔掉设备

    相关文章

      网友评论

        本文标题:Teensy的开发环境部署及基本用法

        本文链接:https://www.haomeiwen.com/subject/whsevttx.html