I just got an Arduino Pro knockoff a few days ago, made by OSOYOO. I really wanted to make my own custom video game controller, since my dream controller doesn't exist yet. I couldn't find anywhere to learn how to code, so I've spent the past few days using many google searches as well as looking through other people's projects to find out how to code, and it's been working so far.
I have no previous experience with arduino, and a little bit of coding experience in Java and C#.
I have a library attached that makes the chip appear as a controller to Windows. So far, I learned how to make buttons work, and then 1 joystick to work. I was working hard to get 2 joysticks to work, and I got close.
I got the chip to be read as two separate remotes, one had a joystick and 5 buttons while the other had the last joystick. I then tinkered with the program to map the second joystick to different inputs on the controller, but after uploading the program to the chip, it disconnected from my PC.
I tried a few things afterwards, but since uploading that program, my Arduino will connect to my PC for a moment, be seen by the IDE software and Windows, then disconnect, before I can't even upload another program. After it disconnects, Windows can't even see the device.
All three lights are solid once the board receives power, and stays that way, even after it "disconnects." The power light is green.
Things I tried were (In this order):
- Unplugging and plugging back in the USB cord
- Restarting my browser (Firefox)
- Uninstalling the Arduino Create Agent, restarting my PC, and reinstalling it
- Using the Reset pin on the arduino
Libraries used:
The last program put on my arduino before this issue:
#include "Joystick.h"
#define JOYSTICK_COUNT 1
// Create Joystick
Joystick_ Joystick[JOYSTICK_COUNT]={
Joystick_(0x03)
};
//Joystick_ Joystick;
void setup() {
//Tell the PC that a controller is connected
Joystick[0].begin(true);
//Establish all the inputs (without resistors)
pinMode(2,INPUT_PULLUP);//1
pinMode(3,INPUT_PULLUP);//2
pinMode(4,INPUT_PULLUP);//3
pinMode(5,INPUT_PULLUP);//4
pinMode(6,INPUT_PULLUP);//UP
pinMode(7,INPUT_PULLUP);//RIGHT
pinMode(8,INPUT_PULLUP);//DOWN
pinMode(9,INPUT_PULLUP);//LEFT
pinMode(10,INPUT_PULLUP);//L1
pinMode(14,INPUT_PULLUP);//R1
pinMode(15,INPUT_PULLUP);//L2
pinMode(16,INPUT_PULLUP);//R2
pinMode(A0,INPUT_PULLUP);
pinMode(A1,INPUT_PULLUP);
pinMode(A2,INPUT_PULLUP);
pinMode(A3,INPUT_PULLUP);
}
void loop() {
//Button 1
if(digitalRead(2)==LOW){
Joystick[0].setButton(0,1);
}else{
Joystick[0].setButton(0,0);
}
//Button 2
if(digitalRead(3)==LOW){
Joystick[0].setButton(1,1);
}else{
Joystick[0].setButton(1,0);
}
//Button 3
if(digitalRead(4)==LOW){
Joystick[0].setButton(2,1);
}else{
Joystick[0].setButton(2,0);
}
//Button 4
if(digitalRead(5)==LOW){
Joystick[0].setButton(3,1);
}else{
Joystick[0].setButton(3,0);
}
//Button UP
if(digitalRead(6)==LOW){
Joystick[0].setButton(4,1);
}else{
Joystick[0].setButton(4,0);
}
//Joystick 1
Joystick[0].setXAxis(analogRead(A0));
Joystick[0].setYAxis(analogRead(A1));
//Joystick 2
Joystick[0].setZAxis(analogRead(A2));
Joystick[0].setRzAxis(analogRead(A3));
}
Note:
#define JOYSTICK_COUNT
equals one because that variable controls how many times the program makes a controller visible to Windows, rather than an actual joystick count. I pulled it from another person's project and experimented with it.
The error on the Web Editor IDE:
"Error uploading, check if the selected board is currently available."
Schematic (Apologies, it's my first time drawing one up):
I didn't realize the schematic would come out so poorly, I'm sorry. The things connected to my arduino are 5 buttons and 2 joysticks. These were on the arduino when I uploaded the program to it.
Specs:
OS: Windows 10 Insider Preview 19041.1 (vb preview) (64 bit)
Browser used: FireFox 75 (64 bit)
Usb ports used: 3.0, 3.0
Board brand: Osoyoo, bought from here:
IDE version: Unknown, I used the web editor
I purchased the board less than a week ago, brand new