6

Its not as easy as you think. An Arduino will not be enough for connecting the USB of the 3D printer. The USB protocol is strictly divided into slaves and masters. A USB(us) has exactly one master, which totally controls, what the slave can do. The slave itself cannot do much of its own. Your 3D printer is a USB slave device. That enables a USB master (like ...


4

First of all you have to make sure, that you select the same baudrate in the Serial Monitor, that you used in your sketch with Serial.begin(). This error is very common and garbage values is the symptom of this. But your code also has problems. You have the input variable of type String, which should hold the user input for comparison with the password. ...


2

Just adding some numbers to complement JRobert's answer. On the Uno, the cost of calling a function and returning from it is about 0.5 µs. In contrast, calling analogRead() within a loop costs at least 112 µs per iteration. Given that you are computing the sum as a float (where a suitably sized integer would suffice), it may well be more that 112 µs in your ...


2

Writing the code out four times, in line, is a little bit faster than calling a function because the function call and return take some time, and the loop instructions take some time, and neither of those contribute to the average calculation. Writing a function that you use four times, however, is much more readable, is much easier to fix if you've made a ...


2

The Nano, like the Uno, has an onboard serial ↔ USB converter. If you can get a logic level serial from the Moxa, then you can use the Nano to convert that to USB: Load a do-nothing sketch in the Nano Connect the Moxa TX to the Nano's Tx through a 1 kΩ resistor, and the Moxa RX to the Nano's RX. Yes, the second step looks backwards. The reason is that the ...


2

Your calculation is not correct. The encoder has its 0 to 10V output voltage distributed over the whole distance, that the cable can reach, so 1.25m. And that gives you the resolution: 1.25m/1024 = 1.22mm. The resolution doesn't change, if you use less than the maximum length. It's still the same resolution of about 1.22mm. The encoder doesn't care, if you ...


2

Random Characters can Happen in several ways. Check the Wires for: Loosen Ends; Broken Wires and Wrong Pin Connections. Check your Code.


1

the RX1 or Arduino mega to the TX1 of the sensor (pin2) and That will not work. These pins are for RS232, which uses the same communication protocol (UART) as the Arduino, but it uses different voltage levels. But fortunately your sensor has also RX and TX pins at TTL level (Transistor-Transistor-Logic). You want to connect these to the Arduino. One thing ...


1

There's not enough information to provide a general solution at this time. As chrisl rightly says, the 3D printers are expecting a connection from a host. That host connection depends on whether the USB-serial interface inside the printer is supported. These are typically FTDI or WCH (QinHeng) chips, and would need the appropriate system driver for each type....


1

I've got I2C to work reliability between Arduinos with different byte sizes. I have copied the test code below. Note that there is separate code for sending and receiving. It may need to be tweaked but contains the basic idea. One (or more) Arduinos sends to main I2C controller: Sender Code: //sender test #include <Wire.h> #include <Wire.h> #...


1

The best solution would be to use an RS485 adapter connected to each Arduino via serial port. This is a tried and true solution that is perfect for a setup like this and only costs a few bucks of extra hardware per node. If you can't use additional hardware, you can also create a poor-man's current loop system like RS485 using normal Arduino pins since they ...


1

PS: @lurker's suggestion in the comments - check the baud rate setting in your serial monitor as well. EDIT: I admit that the code in the previous version of this answer was foolishly typed out by me due to lack of patience, so I'll make up for my mistake(not in code, but as a full answer). First of all, I didn't understand what you wanted to do with the ...


1

This buildin LED is connected to an IO pin of the microcontroller on the Mega (most commonly pin 13, but might be different depending on the board). So the meaning depends on what the code on the Mega does with it. When the board is reset (which happens on opening of serial connection), first the bootloader will run. It gives you a short blink on the buildin ...


Only top voted, non community-wiki answers of a minimum length are eligible