You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all I would like to congratulate for this product, the code is very well written and organized.
I found you library when trying to find a to communicate with my Arduino Mega 2560 and my Java Code.
When I try to use the digitalWrite I get a validation error saying that the port should between 0 - 7. I checked the source and there's a validations in BoardMessageFactory.validatePort (which is called by the digitalWrite). The code is:
int ports = (int)Math.ceil((maxPin + 1) / 8.0);
In the case of a 2560 board, the maxPin is 54, so the result of the above expression is 7. That's why I didn't accept my digitalWrite on port 13.
Is this validation correct or I'm doing something wrong?
Bellow is my test code that tries to blink the onboard led on the arduino mega:
MessageFactory board = new Mega2560();
board.pinMode(13, SetPinModeMessage.PIN_MODE.INPUT.getMode());
ISerial serial = new IndepProcessingSerialAdapter(new IndepProcessingSerial("/dev/tty.usbmodem1411", 57600));
Firmata firm = new Firmata(serial);
serial.start();
firm.send(board.pinMode(13, SetPinModeMessage.PIN_MODE.OUTPUT.getMode()));
for (int i = 0; i < 5; i++){
System.out.println("Setting HIGH");
firm.send(board.digitalWrite(13, HIGH));
Thread.sleep(5000);
System.out.println("Setting LOW");
firm.send(board.digitalWrite(13, LOW));
Thread.sleep(1000);
}
serial.stop();
Thanks in advance,
Aristides
The text was updated successfully, but these errors were encountered:
First of all I would like to congratulate for this product, the code is very well written and organized.
I found you library when trying to find a to communicate with my Arduino Mega 2560 and my Java Code.
When I try to use the digitalWrite I get a validation error saying that the port should between 0 - 7. I checked the source and there's a validations in BoardMessageFactory.validatePort (which is called by the digitalWrite). The code is:
int ports = (int)Math.ceil((maxPin + 1) / 8.0);
In the case of a 2560 board, the maxPin is 54, so the result of the above expression is 7. That's why I didn't accept my digitalWrite on port 13.
Is this validation correct or I'm doing something wrong?
Bellow is my test code that tries to blink the onboard led on the arduino mega:
Thanks in advance,
Aristides
The text was updated successfully, but these errors were encountered: