-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arduino as client #434
Comments
You will have to write an application for one Arduino, but yes the other can use Firmata since the Arduino Firmata library is written for both cases, however there are no example I'm aware of that use Firmata in this way since most user's motivation with Firmata is to control an Arduino using an application written in a language other than C/C++. |
You can also use the Firmata library for communication without using the StandardFirmata sketch (StandardFirmata is just an example use of the library after all). |
Could this be an example "FirmataBlink"? (sort of)
This would be the client code (on the "master" Arduino) while the other Arduino would be flashed with a StandardFirmata. |
That's not unreasonable, but your implementation uses the legacy What you are attempting to do, can be made much more simple by utilizing the #include <FirmataMarshaller.h>
firmata::FirmataMarshaller marshaller;
void setup() {
Serial.begin(57600);
marshaller.begin(Serial);
marshaller.sendPinMode(LED_BUILTIN, OUTPUT);
}
void loop () {
marshaller.sendDigital(LED_BUILTIN, HIGH);
sleep(1000);
marshaller.sendDigital(LED_BUILTIN, LOW);
sleep(1000);
}
|
Thanks! I'll try it. |
Yes, that is correct. Just to clarify terms, we consider what you're calling "slave" as the |
Yes I am calling:
|
Hello, I am trying to accomplish a similar thing. I tried compiling your code but it gives error. I am using the built-in firmata library in arduino ide (v2.5.8). Do I need to change something? |
I think that was sample code to give an idea, the real code should be something like:
|
@atrent Thank you so much for the quick reply. I am trying to control arduino mega using esp8266 board and mqtt over WiFi. This just made everything a piece of cake! 😀 |
I still have to try a setup using ESP8266 with an Arduino slave, did you already try? Did you succeed? Can you post here your setup and final code? Thanks |
Yes I did. Tried it just now and it works flawlessly. I am using NodeMCU board as firmata master/client and flashed the above code you just mentioned. However, one slight change. When flashing to NodeMCU or any other esp8266 board, you would need to change the BUILTIN_LED variable to the actual pin number of the slave (Arduino uno in my case). You specifically have to mention pin 13 and not write BUILTIN_IN. I flashed the FirmataStandard.ino (present in Arduino IDE) example file on Arduino slave. No changes needed. Connected NodeMCU TX pin to Arduino uno RX pin and GND to GND. That's all. The LED on the slave started blinking. Thank you! |
Yep, the LED_BUILTIN problem (not always mapped correctly on ESP8266 boards) is known. Thanks again |
@atrent Can this issue be considered resolved? Also, thank you for fixing up my pseudo-code! |
I think it would be great to include an example in the lib package, then resolved ;) |
An example with callbacks please... |
Loud and clear. The best "example" is probably |
Yep, an example in the "examples" directory, such as a "RemoteBlink.ino" sketch (to be coupled to StandardFirmata...) |
Hi, do I understand correctly that, with the current Firmata lib for Arduino, it is not possible to use an Arduino as "client"? (e.g., having two Arduinos/ESP8266, one slave of the other)
If so, is there any development effort undergoing?
If I'm wrong (as I hope) can you point me towards the right doc/example?
Thank you
The text was updated successfully, but these errors were encountered: