Help us understand the problem. What is going on with this article?

Digisparkを動かす

More than 3 years have passed since last update.

Digispark

DigisparkはUSBに直接挿せるマイコン(ATTiny85). ソフトでUSB制御.
keyboardやmouseのエミュレートなど得意
* digiStump : Digispark Development board
* Digispark - The tiny, Arduino enabled, usb dev board!
* (参考) 安価なUSB直挿しマイコンDigisparkのススメ

購入

  • HiLetgo Digispark Kickstarter ATTINY85 Digispark 超小型Arduino互換 (183円)

    一応、ちゃんと使えてますが、クローンだとP5がリセットピンになっているようなので、そこだけ要注意です。
    DigisparkのQ&Aフォーラムでは、クローンではP5がI/Oに使えずリセットになっているのが有ると書かれてました。

  • rev.3 というのはclone?!

設定

http://homemadegarbage.0t0.jp/digispark-1
http://digistump.com/wiki/digispark/tutorials/connecting

Digisparkへの書き込み

Digisparkにはリセットボタンがないため、書込みボタンをクリック後”Plug in device now…”と表記されてからDigisparkをUSBポートに差し込む。問題がなければ書き込みが開始する。
いちいち抜き差し面倒なのでダイソーのスイッチ付きUSBコネクタや延長コードがあると便利です。

  • HUB経由だと書き込みうまく動作せず.PC直結でうまく書き込めた.
  • ArduinoIDEなしで単体でつないでも認識繰り返すだけで正解
  • シリアルportは割り当てされないため未設定でよい.

詳細

Differences (from the Arduino) and limitations
http://digistump.com/wiki/digispark/quickref

Pin outs:

All pins can be used as Digital I/O
Pin 0 → I2C SDA, PWM (LED on Model B)
Pin 1 → PWM (LED on Model A) ★ 手元のDigisparkはModel A
Pin 2 → I2C SCK, Analog In
Pin 3 → Analog In (also used for USB+ when USB is in use)
Pin 4 → PWM, Analog (also used for USB- when USB is in use)
Pin 5 → Analog In

Many existing libraries will not work with the Digispark: For I2C devices check out the TinyWireM library, which makes it super simple to port an I2C based device library over to use with the Digispark.

sample

#include "DigiKeyboard.h"

void setup() {
  // don't need to set anything up to use DigiKeyboard
  pinMode(1  , OUTPUT);
}


void loop() {
  // this is generally not necessary but with some older systems it seems to
  // prevent missing the first character after a delay:
  DigiKeyboard.sendKeyStroke(0);

  // Type out this string letter by letter on the computer (assumes US-style
  // keyboard)
  digitalWrite(1, HIGH);  
  DigiKeyboard.println("ryu!");

  DigiKeyboard.delay(500);
  digitalWrite(1, LOW);  

  // It's better to use DigiKeyboard.delay() over the regular Arduino delay()
  // if doing keyboard stuff because it keeps talking to the computer to make
  // sure the computer knows the keyboard is alive and connected
  DigiKeyboard.delay(5000);
}
kummn
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした