A one wire communication program with problems

Please provide a verbal walk through of that code. Also, it appears to produce some kind of output sequence. What is it?

Another way to explain this, you say "This does not work "... to get help, helpers need to know how it does (or is intended) to work.

Here we go:

  • It is a one-wire two way communication and initiation program.
  • The program uses character recognition by pulse length. It increments per character.
  • Serial speed, device IDs, communication transmission speeds and time can all be set.
  • Messages are currently being send through the serial monitor or generated inside the program, for instance when booting. Specific routines are also triggered on boot.
  • The communication pin is both to send and receive and should therefore be carefully monitored. When it is not sending the pin is currently monitoring incoming transmissions.
  • After receving a message a reply is send to indicate reception. The return currently is simply blocked by a boolean to prevent it going back and forth.
  • Specifics parts of the message Strings are recognized.
  • They are: 1. The initiation of a variable which can trigger a routine. 2. The reception of time-code which is acted upon. 3. The detection and reception of a byte.
  • Like PWM which is triggered by reception or input of a specific variable with value 7101.
  • By sending f or t through the serial you can also trigger a routine.
  • A 60 second inactivity monitor is also present.
  • I will add/change a few things after it is stable in transmission.

I am not checking the pin reception yet because the PWM is not even toggling. If I fix this then I move on to the important part of reception. PWM toggling would point towards a more decent flow.

Uploading the program to any kind of board might also help understanding but I would not want to ask too much of your time. Might be fun as it talks back to you!

Duplication of the system for testing purposes would require a wiring diagram.

Duplication of the system for testing purposes would require a wiring diagram.

That would be one wire on pin 16 on both the sending and receiving Arduino. One wire out of pin 2 to monitor PWM. One wire in pin 17 to monitor forwarding.

What is the significance of that number?

Pin 16 connected to ???
Pin 2 connected to ???
Pin 17 connected to ???

Please just post a diagram!

What is the significance of that number?

That is just a randomly chosen number, could be any four digit number. Read the boot message if you like:

Serial.println();
Serial.println(F("Pin 16 is used for communications, Pin 17 for forwading incoming communications, Pin 4 is outputting the PWM and Pin 2 is reading a analog voltage."));
Serial.println(F("Not every character was coded. More characters, words or direct function recognization can be added with a change in code."));
Serial.println(F("Always use TABS for message letter input as seen below. The currently coded characters are:"));
Serial.println(F("A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, -, ., , ?, -, =, :, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9"));
Serial.println(F("Four digit function values or fourteen digit time-codes (YYYYMMDDHHMMSS) are detected inside the message automatically when using the following formats: FUNCTIONVALUE=, TIMECODE=, BYTE="));
Serial.println(F("The function values can be triggered at any time by inputting 'f' or by inputting 't' and then a fourteen digit time-codes (YYYYMMDDHHMMSS) through the serial monitor, they are then initiated and transmitted."));
Serial.println(F("With added coded one can call and transmit function values or time-codes automatically at specific events. Or add things like an NTP retrieval, RTCs or RF transmissions"));
Serial.println(F("Currently the following standard functions values are programmed and can be called..."));
Serial.println(F("Everything between 0000-5000 is reserved for a voltage, 6001-6999 sets the PWM output frequency in kHz, 7001-7100 sets the PWM duty-cycle, 7101 starts PWM, 7102 stops it, 7103 measures a voltage, 7104 sets the device voltage to 3.3V, 7105 sets it to 5V, 7107 starts foorwarding and 7106 stops forwarding."));
Serial.println(F("Finally: call a function value between 8001-9000 to update the maximum signal speed in microseconds on both the sending and receiving end. Call 9001 to retrieve the amount of messages send and received."));
Serial.println();

Please unpack the boot message and post it as text, if it is the documentation. Run the program and capture the output with "copy" and paste in a new message.

Pin 16 connected to ???
Pin 2 connected to ???
Pin 17 connected to ???

Making a diagram would be to complex for this, it is really simple.

  • Pin 16 on the sender connected to Pin 16 on the receiver (you need two ports to actually send and receive). Maybe some large value pull-down resistors later on but it should work for now.
  • Pin 2 connected to an osciloscope for testing for testing the PWM.
  • Pin 17 to an osciloscope for now to see if it forwards.

If it does not work I might have to change it to detecting a LOW state by using INPUT_PULLUP.

Please unpack the boot message and post it as text, if it is the documentation. Run the program and capture the output with "copy" and paste in a new message.

Sorry it is there so please use that.

Good luck with your project. Goodbye.

Good luck with your project. Goodbye.

Thanks. Although I do not really understand what your problem is. I explained in the first post:

  1. The communication pin is sending but not yet receiving.
  2. The PWM and forwarding pin are not toggling.

This might explain:
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966

This might explain:
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966

Not sure what you are pointing at.

Maybe someone else wants to help. I'm out, permanently.

Maybe someone else wants to help. I'm out, permanently.

Up to you.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.