You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running "HID-Project" in the following environment.
Windows11
Screen resolution: 1920x1080
"ACEIRMC is compatible with Arduino Leonardo and works as Pro Micro"
I want to use the mouse functions of "HID-Project"
I'm writing a test code in the loop function of the "arduino IDE", but it doesn't work as expected.
I can't figure out the cause on my own, so please help me.
Thank you for your support.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am running "HID-Project" in the following environment.
I want to use the mouse functions of "HID-Project"
I'm writing a test code in the loop function of the "arduino IDE", but it doesn't work as expected.
I can't figure out the cause on my own, so please help me.
Thank you for your support.
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Wire.h>
#define LAYOUT_JAPANESE
#include <HID-Project.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
#define OLED_RESET -1
#define Wire_SDA 2
#define Wire_SCL 3
//!
Adafruit_SSD1306 display( SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET );
const int BTN_PIN = 9;
//! プロトタイプ宣言
int SetAutoStart();
void setup()
{
Wire.begin();
// 初期設定
if( !display.begin( SSD1306_SWITCHCAPVCC, 0x3C ) ) {
Serial.println( F("SSD1306:0 allocation failed") );
for (;;);
}
// OLED表示設定
display.setTextColor( SSD1306_WHITE );
// ボタン
pinMode( BTN_PIN, INPUT_PULLUP );
// Mouse
AbsoluteMouse.begin();
}
void loop()
{
//! ボタン
int value = 0;
value = digitalRead( BTN_PIN );
//! ボタン
SetAutoStart();
//! I2C
display.clearDisplay();
display.setTextSize( 1 );
display.setCursor( 4, 0 );
display.println( value );
display.setTextSize( 1 );
display.setCursor( 4, 8 );
display.println( "OLED" );
display.display(); // 表示実行
}
int SetAutoStart()
{
if( digitalRead( BTN_PIN ) == LOW ){
//! "LOW" == ボタン押してる
digitalWrite( BTN_PIN, LOW );
AbsoluteMouse.click();
delay( 300 );
digitalWrite( BTN_PIN, HIGH );
}
if( digitalRead( BTN_PIN ) == LOW ) {
digitalWrite( BTN_PIN, LOW );
AbsoluteMouse.moveTo( -960, 0 );
delay( 300 );
digitalWrite( BTN_PIN, HIGH );
}
/*
if( digitalRead( BTN_PIN ) == LOW ) {
digitalWrite( BTN_PIN, LOW );
AbsoluteMouse.move( -960, 8 );
delay( 300 );
digitalWrite( BTN_PIN, HIGH );
}
*/
return 0;
}
Beta Was this translation helpful? Give feedback.
All reactions