Hardware Automation with arduino devices

  • Thread starter Thread starter Aheago
  • Start date Start date
  • Views Views 1,296
  • Replies Replies 2

Aheago

Well-Known Member
Member
Joined
Jan 4, 2021
Messages
505
Reaction score
400
Trophies
0
Age
35
XP
1,255
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);
 
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,
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