mirror of
				https://github.com/digistump/DigistumpArduino.git
				synced 2025-11-03 21:14:46 -08:00 
			
		
		
		
	Initial import of support files for all Digistump boards - Digispark, Pro, DigiX - including libraries, examples, tools, and other support files for the Arduino IDE
This commit is contained in:
		@@ -0,0 +1,39 @@
 | 
			
		||||
// 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
 | 
			
		||||
  //while(!DigiMouse.isConnected()) {} //don't run sketch until USB is connected
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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.delay(500);
 | 
			
		||||
  DigiMouse.moveX(20); //right 20
 | 
			
		||||
  DigiMouse.delay(500);
 | 
			
		||||
  DigiMouse.scroll(5);
 | 
			
		||||
  DigiMouse.delay(500);
 | 
			
		||||
  
 | 
			
		||||
  // or DigiMouse.move(X, Y, scroll) works
 | 
			
		||||
  
 | 
			
		||||
  // three buttons are the three LSBs of an unsigned char
 | 
			
		||||
  DigiMouse.setButtons(1<<0); //left click
 | 
			
		||||
  DigiMouse.delay(500);
 | 
			
		||||
  DigiMouse.setButtons(0); //unclick all
 | 
			
		||||
  DigiMouse.delay(500);
 | 
			
		||||
 | 
			
		||||
  //or you can use these functions to click
 | 
			
		||||
  DigiMouse.rightClick();
 | 
			
		||||
  DigiMouse.leftClick();
 | 
			
		||||
  DigiMouse.middleClick();
 | 
			
		||||
 | 
			
		||||
  //for compatability with other libraries you can also use DigiMouse.move(X, Y, scroll, buttons)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user