PIR+ARDUINO+PDUINO
Hi @David and @Alexandros, thank you so much for your help, it is really appreciated.
Alexandros : the arduino abstraction includes comport, here is the arduino object pd:
arduino.pd.zip
I have followed your advice and included the arduino object and print, but this still not working.
Also, when I click on print nothing happens.
Here is my patch:
PIR_Arduino_Puredata V2.pd
What am I missing?
Many thanks again for any help you might provide
PIR+ARDUINO+PDUINO
Jumping in due to David's prompt. I don't use PDuino, but I checked both yours and David's version of your patch, and there's no [arduino] or [comport] object. So, how do you expect to communicate with the Arduino using Firmata, since you don't have these two? [comport] is used for serial communication with USB devices, and [arduino] takes care to translate the user-friendly messages, such as "pinMode 2 input" to bytes in the Firmata protocol. I think the [arduino] abstraction includes the [comport] object, so it takes care of that for you.
From what I understand, you have to send this "pinMode" message to the [arduino] abstraction, and you'll receive some output from it. Connect a [print] to it to see what you get.
pd on raspberry pi 2B stuck multiple times
@KMETE Assuming that you put a [print] on the output of [comport]..... does anything print on the first button press?
If nothing is printing then the [comport] connection has failed....... but if it prints on the first button press and not on the second then that is very strange.
You could send a [verbose 1( message into [comport] as the patch starts.... after the [open 0( message..... and put a [print] on its right outlet... which might tell you something.
Maybe because you are sending nothing at all into [comport]..... only receiving.... the socket is dropped after a while.
You could create a "keep alive"....... a useless message like [print alive( could be banged into [comport] from the patch every 60 seconds by a [metro 60000]. That might help.... no idea but worth trying I think.
Actually [print alive, info( would send the "alive" message and then print the status of comport to its right outlet every 60 seconds.... that might be very useful.
Last thought...... Is there a sleep mode set for the Arduino?
David.
comport report if connection lost and retry to connect
I did the follow:
so if there is no data at the comport outplet it will bang the open $1 message every 1 sec.
Does it make sense? is there any problem with sending open message to the comport every x interval? can it stuck it? or make more harm then good?
Comport in browser?
Hi! I'm stuck in a room with a Chromebook and an Arduino. I've got purrdata.glitch.me/ from @cuinjune working in one Chrome tab and Arduino IDE in another tab monitoring the serial input. What would be needed to get comport to read the serial port from the usb/arduino?
I guess the ultimate goal is: what is the lowest latency setup from an Arduino sensor into PD on a chromebook or browser only?
I don't necessarily need the Arduino environment running for my uses, it's just that it looks like it's running an agent that allows the site to access the usb. Thanks for any thoughts!
problem with loading Gem in startup
@maddynakedymaddy That looks like a windows path and I would therefore expect Gem to be in the C:/Program Files (x86)/Pd/Pd/extra folder...... and not /externals
But check your startup flags in Preferences.... startup.
There needs to be -lib Gem in the startup box...... and it is possible that the flag is there but has been disabled (you will not see that the flags are disabled).
Sometimes the flags are disabled when Pd cannot set them properly as it starts. You would have had a message about that and the console would be empty at startup if that happened.
Simply clicking ok or apply will reapply the startup flags...... but you will get another message at the next start saying they are disabled if any of your startup flags cannot be applied.
Otherwise.... it is not likely that it is a virus.... but it could be a security permission problem from an OS update or an antivirus and you can usually set exceptions. Pd is not in any database that will automatically recognise it as a secure program so........
But I would expect that to stop Pd running at all..... so unlikely.
David.
Pd-L2ork crashes when running arduino-test file from pduino on Raspberry Pi
I am running this on a Raspberry Pi 4 model B with 2G RAM (latest Rasbian OS installed), with a Teensy ++ 2. I installed arduino IDE and TeensyDuino, and loaded the StandardFirmata firmware to the teensy successfully.However when I open Pd-L2Ork, and load the arduino-test.pd file from the Pduino examples, nothing is working, and I get the following error on repeat:
error: gatom_list: need float or symbol
If I delete the subpatch that is above the analog input numberboxes, those errors stop. Then, I am able to use the patch to select a comport. the comport opens successfully:
[comport] opened serial line device 1 (/dev/ttyAMA0)
But then, if I try to do anything like enable an analog input or request the firmware version, nothing works, and I get the following error:
error: [comport]: Write failed for 0 bytes, error is 2
And then... after trying one thing or another a few times, pure data crashes entirely. I have searched google for a solution but am coming up short. Does anyone have any idea what might be happening?
Arduino->Pd with Open Sound Control
@jameslo Thanks a lot!
I can send messages locally between Pd, Processing and Unity. But not Arduino.
oscProcessing.pd
oscUnity.pd
oscP5sendReceive.pde
These works but I can still not for example replace Processing with Arduino.
@jameslo said in [Arduino->Pd with Open Sound Control] do you need bidirectional messaging? What data are you passing (if any)? What Arduino library would you prefer to use (I see there are more now than when I started)? is it over WiFi or ethernet or something else?
-bidirectional is good. Type of data, analog float, and digital. I have no preference for what library I use. I just want to make it work locally on a single computer.
I would like to use the Arduino as a controller for Pd through OSC.
For example, 5 analog ins on the Arduino that I after som treatment (smoothing and more) send locally to Pd, with custom osc addresses: /myArduino/analog-0
Having lots of switches into Pd
Here is the working Arduino code, (which is basically a straight copy from "project 8", but I wrote it while reading the tutorial)
// setup for 6 analog in och 12 digital in (pullup to be added).
//intended as experimental template. use pd patch
//made with tutorial Arduino for Pd'ers, project 8
byte myArray[25];
void setup()
{
for(int i = 2; i < 14; i++)
pinMode(i, INPUT);
Serial.begin(9600);
}
void loop()
{
myArray[0] = 0xc0;
int index = 1;
for(int i = 0; i < 6; i++){
unsigned int knob = analogRead (i);
myArray[index++] = knob & 0x007f;
myArray[index++] = knob >> 7;
}
for(int i = 2; i < 14; i++)
myArray[index++] = digitalRead(i);
Serial.write(myArray, 25);
}
Then I tried to incorporate project 1 (blink):
// set a variable to hold the ledddddddz pin number
int led = 13;
void setup()
{
// st pin 13 as output, to light up the LED
// whenever it is told so from Pd
pinMode(led, OUTPUT);
// start the serial communication o the Arduino
// and Pd can communicate with each other
Serial.begin(9600);
}
void loop()
{
while(Serial.available()){
byte ledState = Serial.read() - '0';
digitalWrite(led, ledState);
}
}
but when I tried to edit "blink" to work with several outputs and merge this in the project 8 code, I decided that I do not have enough understanding of the arduino code to pull it through. What is needed is, I think, another "for()" combined with digitalWrite() inside void loop()
Note: My plan now is to (still) use several Arduinos but with your code and abstractions (instead of the Pdunio). I will wait with the matrix switch setup since I have to take this in steps in order to have control of it.
This means that I am up and running, unless I want to use digital input and output from the same Arduino at the same time. I figure it would be great to have that sorted out beforehand so it works when I need it.
Thanks a lot.
PD/pduino patch not allowing comport to work no matter what
@rei In the Pd terminal top menu "File" "Preferences" "Path"...... add the complete path from root to the comport folder.... and then Pd will find the objects in that folder.
If the object will still not create then you might have a mismatch between 32bit and 64bit versions (wrong for your installation of Pd).
Normally the comport folder should be in the Pd/extra folder...... the extra folder is always searched by Pd as it is the standard path for externals....... but maybe not for Linux..... unsure.
But looking harder at your post...... you should have...... somewhere..... a binary..... comport.pd_linux
If you don't then you need to compile it.
In your screenshot I see "makefile" in Pd/externals along with other comport files.
That is the file that will compile comport when you type "make" in a terminal window opened in that folder....... cd in the terminal into that folder and then enter "make" I think...... https://www.dummies.com/computers/operating-systems/linux/linux-how-to-run-make/
The comport.dll I see is for windows.... of no use on your system.
David.