You are here


Subscribe to FEED feed
The Jeronimus.Net blogUnknownnoreply@blogger.comBlogger166125
Updated: 4 min 4 sec ago

ATTiny85 Mouse

Tue, 2019-08-20 08:43
The ATTiny85 can not only act as a keyboard, it can also act as a mouse.
Extreme caution if you use this as the program does not only mouse movements, it also clicks!
( Examples \ DigisparkMouse \ Mouse )

// DigiMouse test and usage documentation
// CAUTION!!!! This does click things!!!!!!!!
// Originally created by Sean Murphy (duckythescientist)

#include <DigiMouse.h>

void setup() {
  DigiMouse.begin(); //start or reenumerate USB - BREAKING CHANGE from old versions that didn't require this

void loop() {
  // If not using plentiful DigiMouse.delay(), make sure to call
  // DigiMouse.update() at least every 50ms

  // move across the screen
  // these are signed chars
  DigiMouse.moveY(10); //down 10
  DigiMouse.moveX(20); //right 20

  // or DigiMouse.move(X, Y, scroll) works

  // three buttons are the three LSBs of an unsigned char
  DigiMouse.setButtons(1<<0); //left click
  DigiMouse.setButtons(0); //unclick all

  //or you can use these functions to click

  //for compatability with other libraries you can also use DigiMouse.move(X, Y, scroll, buttons)
I have tested this script on with my digispark and it worked. The movements are relative to the current position. I did not dare to experiment and move it to bottom left on a windows computer and use Microsoft start to start programs.

ATTiny85 Keyboard

Mon, 2019-08-19 09:00
One of the scripts that works on my attiny85 is a keyboard emulator.
All is done  with the next simple script that was available as a sample script in the library;
(   File \ Examples \ DigisparkKeyboard \  Keyboard )

#include "DigiKeyboard.h"

void setup() {
  // don't need to set anything up to use DigiKeyboard

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

  // Type out this string letter by letter on the computer (assumes US-style
  // keyboard)
  DigiKeyboard.println("Hello Digispark!");

  // 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

After uploading the script the program starts so watch out where to put the cursor when uploading the script.
The Digispark USB reacts if it is a keyboard where the  "Hello Digispark!" is typed over and over again (with a delay  5000 ).

Hello Digispark!
Hello Digispark!
Hello Digispark!
Hello Digispark!

An application could be reading some sensor data on the attiny85 and outputting it e.g. in a spreadsheet.

ATTiny85 USB module prepared for experiments

Sat, 2019-08-17 08:46
Recently received some ATTiny85 USB (Digispark Digistump) boards from Aliexpress.
I already experimented earlier with these small boards with chip that can be programmed easy by putting it in the USB connector of your computer.
These boards come (standard) with Dupont connectors (male or female) that you can solder on these small boards to conello Digispark!
nect it easy in experiments. I wanted a not connecting each time Dupont wires, a little bit more protection for the USB module more distance from my computer,.
To prepare a module i cut some wires with female Dupont connectors and soldered this directly to the module. (To prevent shortcuts i used female not the male).
With transparent heat shrink i added some protection for the board.
ATTiny PINsOn the side (bottom of the picture) are three connections (starting from USB)
5V(Color of my wire: )  RedGND      (Color of my wire: ) BlackVin(Color of my wire: ) BrownOpposite to the USB connector are 6 holes
of my
P0(LED on
 model B)ArefPWM0SDAMQSIWhiteP1(LED on
 model A)

xxYellowP5(Reset on
some models)A0

A simple blink script to test the module is
// the setup routine runs once when you press reset:
void setup() { // initialize the digital pin as an output. 
//  pinMode(0, OUTPUT); //LED on Model B
     pinMode(1, OUTPUT); //LED on Model A or Pro }

// the loop routine runs over and over again forever:
void loop() {
//  digitalWrite(0, HIGH);   // turn the LED on (HIGH is the voltage level)
     digitalWrite(1, HIGH);
     delay(500);               // wait for a second

//  digitalWrite(0, LOW);    // turn the LED off by making the voltage LOW
     digitalWrite(1, LOW);
     delay(500);               // wait for a second

The led on my module reacts on P1. So I expect i have a model A.

Share this on

Twitter icon
Facebook icon
Google icon
StumbleUpon icon icon
Digg icon
LinkedIn icon
MySpace icon
Newsvine icon
Pinterest icon
Reddit icon
Technorati icon
Yahoo! icon
e-mail icon