Hardware Automation with arduino devices

Aheago

Well-Known Member
OP
Member
Joined
Jan 4, 2021
Messages
505
Trophies
0
Age
33
XP
1,222
Country
United States
Im interested in making some simple bots of my own for various games using arduino projects similar to this. However, I can't quite figure out how these developers are figuring out the button timings.

for example in this instance. What are the values, 200, 1250, 500, and 5. From my understanding, this isn't like a "sleep" function so they aren't miliseconds or seconds. Correct?

I appreciate any/all help, thank you!
Code:
#include <Arduino.h>
#include <NintendoSwitchControlLibrary.h>

const int _buttonDelay = 200;
const int _dialogDelay = 1250;

void setup() {
  // Connect controller
  pushButton(Button::B, 500, 5);

  // Open boxes
  pushButton(Button::X, _buttonDelay);
 

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,900
Trophies
2
XP
29,557
Country
United Kingdom
It'll be milliseconds, in this kind of context it's always milliseconds.

E: the 5 might not be milliseconds, it's an additional 3rd argument after the time value (2nd argument) and button ID (1st argument), so idk what it represents, probably entirely unrelated to time. But the others are milliseconds.

EE: actually googled the included NintendoSwitchControlLibrary.h which I didn't read before because it's not in the above GitHub, so here's the answer, the 5 is a loop value.

https://github.com/lefmarna/Nintend...lob/master/src/NintendoSwitchControlLibrary.h

Code:
void pushButton(uint16_t button, unsigned long delay_time = 0, unsigned int loop = 1);
 
Last edited by hippy dave,

Aheago

Well-Known Member
OP
Member
Joined
Jan 4, 2021
Messages
505
Trophies
0
Age
33
XP
1,222
Country
United States
It'll be milliseconds, in this kind of context it's always milliseconds.

E: the 5 might not be milliseconds, it's an additional 3rd argument after the time value (2nd argument) and button ID (1st argument), so idk what it represents, probably entirely unrelated to time. But the others are milliseconds.

EE: actually googled the included NintendoSwitchControlLibrary.h which I didn't read before because it's not in the above GitHub, so here's the answer, the 5 is a loop value.

https://github.com/lefmarna/Nintend...lob/master/src/NintendoSwitchControlLibrary.h

Code:
void pushButton(uint16_t button, unsigned long delay_time = 0, unsigned int loop = 1);
I guess I could have looked a bit deeper. Seems like my Google fu skills need to be brushed up on!

Nevertheless this is super helpful information thank you for taking the time to clarify!
 
  • Like
Reactions: hippy dave

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: Well it's probably the one youtube link I posted +1