looping a signal with wires

Hello there,
I have an Arduino receiving data on Pin A and sending it to Pin B. For a small Project I want to add a small button between A and B so after I Press it Pin B will send the information to Pin A as well, to create a loop with the same Information over and over again. Any idea how I can make that work? I tried a few things but nothing worked so far.

Thanks in regards,

Clyde

Hello Clyde,

Please supply a lot more information. Please read the forum guidelines

In particular:
Which Arduino?
How is it wired?
Pins are not labelled A and B so your description makes no sense.
What is is receiving and sending data from and to?
What kind of data connection?
Schematic?
Code?

Thank you.

Hey Perry,
Thanks for your fast reply!
Its a pro micro knockoff with an Atmel 32u4
Its receiving Data from a Gamecube Controller (D6) and sending it to my Wii (D8)
I attached an Image how its wired and the .zip includes the code (also quoted the main page of the sketch, which should be the important bit)

//ESS-split.ino


/* Visit Github for more information: https://github.com/Skuzee/ESS-Adapter */

/*Basic Wiring Information for ATMEGA:
   -Pins 6 & 8 are default DATA Pins, but any GPIO pin will work.
   -Pin 6 --> DATA to Controller
   -Pin 6 --> 750ohm Pull-up Resistor --> 3.3v supply from Console.=
   -Pin 8 --> DATA to Console
   -Currently, I suggest only powering the board from usb only.
   -GND Pin --> Ground wires
   -optional: Pin 4 --> RST Pin (used to reset adapter via Controller by holding the start button for ~6 seconds. Only Used for debugging and programming.)

	Make sure the Controller is still connected: insuring the following:
	 -5v supply from Console --> 5v to Controller (Rumble Motor)
	 -3.3v supply from Console --> 3.3v wire to Controller
	 -Grounds from Console --> Grounds to Controller

	 If your cable has a braided metal shieding, don't connect it to anything.
*/


//Includes
#include "src/Nintendo/src/Nintendo.h"
#include "ESS.hpp"
#include "extra.hpp"
#include "input-display.hpp"


//Options
#define GAMECUBE_CONTROLLER
//#define N64_CONTROLLER - not used in this version - see n64-dev branch
#define INPUT_DISPLAY // - works on 32u4, needs newest compiled version of NintendoSpy (not the old release from 2014).
#define CONT_PIN 6  // Controller DATA Pin
#define CONS_PIN 8  // Console DATA Pin
//#define TRIGGER_THRESHOLD 40 // Makes the L and R triggers act more like Gamecube version of OOT. 0 to 125. 0 being most sensitive. Comment out to disable.


#if NINTENDO_VERSION != 1337
	#error "Incorrect Nintendo.h library! Compiling with the incorrect version WILL result in 5 volts being output to your controller/console! (Not good.) Make sure the custom Nintendo library (version 1337) is included in the ESS-Adapter/src folder and try again."
#endif


CGamecubeController controller(CONT_PIN); // Sets Controller Pin on arduino to read from controller.
CGamecubeConsole console(CONS_PIN); // Sets D8 on arduino to write data to console.


void setup() {
  Serial.begin(115200);
}

void loop() {

  controller.read();
  Gamecube_Data_t data = controller.getData();
  Gamecube_Data_t data_original;	
  memcpy((void*)&data_original, (void*)&data, sizeof(Gamecube_Data_t));	
	
  normalize_origin(&data.report.xAxis, &data.origin.inititalData.xAxis);
  invert_vc_gc(&data.report.xAxis);

  //startButtonResets(data);
 
  #ifdef TRIGGER_THRESHOLD
    analogTriggerToDigitalPress(data, TRIGGER_THRESHOLD);
  #endif

  #ifdef INPUT_DISPLAY
    writeToUSB_BYTE(data_original);
  #endif


  console.write(data);
  controller.setRumble(data.status.rumble);
}

ESS-Adapter.zip (6.4 KB)

Please do not give .zip files for download as less people are less likely to download them...If your file is more than 9,000 charcters long I would prefer you put it in a .ino file or .txt file and give it for download...

To answer the question you asked:

I want to add a small button between A and B so after I Press it Pin B will send the information to Pin A as well, to create a loop with the same Information over and over again.

You wire a single pole single throw switch with the common on 'Pin A' (which I think you mean D8), one side to 'Pin B' (which I think you mean D6) and the other side to DATA on the console. Then 'Pin A' will receive its input from either 'Pin B' or the console depending on the switch position.

However, I have to say that I cannot imagine any sensible reason for doing this.

I don't see anything in the code you posted that either reads from or writes to D6 or D8.

It would help to know what you are really trying to do.

It would help to know what this mysterious data is as it is not, as I first imagined, serial data (or if it is then you have the wrong pins).

[Edit] Like UNOguy I am not going to download your zip file, if the code is too long then create a small, simple program that demonstrates the problem you are having.

TheUNOGuy:
Please do not give .zip files for download as less people are less likely to download them...If your file is more than 9,000 charcters long I would prefer you put it in a .ino file or .txt file and give it for download...

In another Thread I was told to put large projects into .zip files, but thanks for the advice I'll remember that in the future :slight_smile:

I don't need help with the code, the code works as it should and my question is about electrical wiring not about the code.

Even tho it will not help wit my Problem I try to explain it again:

-D6 gets Information from the Controller
-The Arduino changes analog values to improve the analog sticks accuracy (we want to remove the deadzone of the controller with that)
-D8 sends the improved information to my Console

But as I said I don't want to touch the code at all.

What am I trying to do:
I'm trying to make a video to compare different versions of the game, to make that as accurate as possible I need to Mash A and B Inputs in in-game Cutscenes, to skip through the in-game text as fast as possible.
Step one: Enter A Cutscene (Ingame)
Step two: Press the Button That'll Connect D8 and D6
Step three: Press A and/or B on my Gamecube Controller
Step four: D6 gets the Information that I pressed A and/or B
Step five: D8 will send the information that I pressed A and/or B to the Wii Console
Step six: D8 will also send this information back to D6 so D6 will send it to D8 again and so on and so on until I get out of the cutscene.

Best regards,

Clyde

To learn one way to connect and read a button, in the Arduino IDE choose file>Examples>02.Digital>Button

Clyde,
I think I have answered your question as asked. I don't think for one moment it will do what you want.

In your OP you said:

I have an Arduino receiving data on Pin A and sending it to Pin B.

That made me think you probably meant serial data, or possibly I2C but I was guessing as you didn't say.

Then you told us you are using pins D6 and D8 of a Pro Micro but didn't provide a pin out of a Pro Micro. I looked it up and, so far as I was able to tell, those pins are not serial and not I2C, so not that.

Then you said:

-D6 gets Information from the Controller
-The Arduino changes analog values to improve the analog sticks accuracy (we want to remove the deadzone of the controller with that)

So now I think you mean an analogue signal, so not data.

What is the nature of this mystery signal?

Step six: D8 will also send this information back to D6 so D6 will send it to D8 again and so on and so on until I get out of the cutscene.

There's no point, the micro controller already knows what the data is (which is more than I do), there's no point sending it back in. If you think you have to send it back in then your code is wrong.

I am reminded of MYCROFTXXX in the City and the Stars.

Would it be fair if a little rude to suggest you don't really understand what you are doing? :o

PerryBebbington:
Would it be fair if a little rude to suggest you don't really understand what you are doing? :o

That's fair, but If I had an Idea I wouldnt ask in a Forum right? But anyway it seems like you dont understand what I want to do.

PerryBebbington:
There's no point, the micro controller already knows what the data is (which is more than I do), there's no point sending it back in. If you think you have to send it back in then your code is wrong.

The Micro Controller does not read from D8, it reads (gamecube controller-)inputs from D6 and sends them to D8 (which is connected to my wii).
I want a switch that when I press it the same Data repeatedly goes through the wire connected to D8
So my Wii is getting the same information over and over again.

Clyde

Start by adding a button to your setup, and when you get that working, add an appropriate if statement to the program.

Learn to crawl before you try to run.

I appreciate your answer tho that's not what I asked for.
If it's impossible to make my plans work out and repeatedly send the same information over and over again (with electrical wiring) , then just tell me its not possible. I mentioned more than once that I'm not going to change the code in any way.

That's fair, but If I had an Idea I wouldn't ask in a Forum right?

Yes of course but I think you are trying to get a solution to work when the solution won't work. I think you need to go back from the solution and define clearly the problem then ask for help with solutions.

But anyway it seems like you don't understand what I want to do.

That may well be true, but as the person asking for help I kind of think you need to communicate what you want clearly enough that I or someone like me does understand. If I don't get it then it's up to you to explain better. I have been explicit in some of the things I don't think you've explained well, I'm still waiting to know the nature of this mystery signal.

The Micro Controller does not read from D8, it reads (gamecube controller-)inputs from D6 and sends them to D8 (which is connected to my wii).
I want a switch that when I press it the same Data repeatedly goes through the wire connected to D8
So my Wii is getting the same information over and over again.

I've re-read your OP and your reply #5 where you clearly said:

Step six: D8 will also send this information back to D6 so D6 will send it to D8 again

I don't see any other possible interpretation of that than data connected via a switch from D8 to D6 so the data coming out of D8 goes back into D6. This is pointless. Now you are saying that's not what you want. Forgive me for feeling frustrated.

Do you mean you want to press a button and the same data will be sent over and over from D8? Nothing to do with D6? If you meant that then jremington has given you the answer.

clydedanger:
I appreciate your answer tho that's not what I asked for.
If it's impossible to make my plans work out and repeatedly send the same information over and over again (with electrical wiring) , then just tell me its not possible. I mentioned more than once that I'm not going to change the code in any way.

You can't do it with wiring. The wiring cannot store any data, let alone repeat it.

You're right on that! It has nothing to do with D6, but I had to think about that a a little bit more to come to the conclusion that that's not the right way of doing it. Sorry for the bad approach asking for help, wasn't on purpose tho. If it's not possible with wiring I have the answer I was looking for, thanks for your help anyway.

Clyde

If it's not possible with wiring I have the answer I was looking for, thanks for your help anyway.

You are welcome!

You have a choice now, forget the idea or learn to code and create something that does do what you want. I hope you choose the second option. You will experience deep frustration and great joy :slight_smile:

The Problem is that we need a solution pretty quickly, in the next couple of days.
I even made some changes in this and in another program and yes I can confirm it was extremly frustrating but also very rewarding. However the code is very complex and doctored together, so I don't see this is going to be something that I can do real quick in the next couple of days. I'll give it a try tonight but in the end there is a simple solution but I would need to buy a new Controller for that.

Anyway, Thanks again have a nice day!

You need to find the bit that sends out the data and make it repeat. That assumes that somewhere in there all the data is stored.

You could try gigs and collaborations and see if anyone wants to take it on as a paid job (no, before you ask me).

If you do want to do that probably best to ask the mods to move this rather than have a duplicate. You can edit the original post to explain what has happened and what you want.