Sending information to Arduino from Pure Data - arduino

I've just got my hands on an Arduino and have started having a little play with it.
I've followed this tutorial and managed to get that simple patch working. I've modified the PD patch a little to trigger the LED on port 9 when a bang connected to a kick drum is hit:
This works, but I've now hit a road block.
I'd like 1 bang (Kick) to trigger 1 LED on port 9 as it is at the moment, but I'd also like another bang, connected to a snare to trigger another LED on port 8.
I've absolutely no idea how to do this. I'm sure it's not too hard but I'm very inexperienced with coding.
I've given it a go at writing the code but it's not working and I'm not sure what more I need to add to PD.
Here's what I've tried to do:
But it doesn't work.
Please please can someone help me out here?
Thanking you :)

In the tutorial you reference you write a custom Arduino sketch for what you want to do in the Pd patch. The alternative method would be to upload a kind of a firmware sketch to the Ardunio which turns the Arduino in a versatile interface. Then you can set the digital ports to in, out or PWM as you like. Someone has done that for you and it's called Firmata. Firmata is included with Arduino, you'll find it in the examples. Upload the standard Firmata to your Arduino and then use the Arduino object in Pd to control it.

Related

Pairing (security) example for Seeed XIAO nRF52840

I can't find example how to do BLE pairing with Seeed XIAO nrf52840 board. It doesn't matter to me if it will be Arduino or Circuitpython libraries. Is there something like this somewhere?
I would like to use this board for my project, but would like to ensure that anyone cannot read or change values in the BLE services.
My idea of use is that on the server side I select the device I want to pair with and on the device side I confirm the pairing manually e.g. with a button. From that point on, the server can then communicate with the unit and read or change its values.
Thank you
With Arduino you could try this example: https://github.com/adafruit/Adafruit_nRF52_Arduino/tree/master/libraries/Bluefruit52Lib/examples/Peripheral/pairing_passkey
I am actually trying to implement this feature as well. I was trying in CircuitPython, but I could not find a suitable way. I opened an issue, as there was nothing in their documentation to help.
UPDATE 2023-01-03 - In CircuitPython BLE security is not yet implemented, see answer to the issue I opened.

Getting two arduinos to interact without wiring them together

Okay, I've been working on this project for months with this being what has stopped me, heres the situation.
I am making a glove that can move a robot arm. The glove has an Arduino Nano iot 33 attached. The board measures the orientation with the built in imu, and sends it to my laptop (will be a raspberry pi in the future) through a usb cable. Also connected to the laptop is an Arduino Uno r3. This board is what makes the robot move (the servos are wired to it and I attached a display that shows the orientation of the glove here). I pondered how to make the Arduino Nano communicate to the Arduino Uno for a while, and I settled on keyboard presses. The Arduino Nano would press certain buttons based on its orientation and the Uno would wait for them to be pressed to move the robot. Turns out that after over 1000 lines of code, the Arduino uno can't use the keyboard library, and I'm stuck again. Is there a better way to go about this?? or is there a way to get the Arduino uno to get keyboard commands (I'm sixteen, tryin to save for college, I know theres a way to buy something to bypass the boards chip, I've already spent quite a bit on arduinos and PLA and such, and if im gonna buy something I want to use it again, please keep that in mind)
How would you have gone about this? How can I recover this project? Please help me...
this is an amazing project.
Great idea the link over SerialUSB, but it is very very slow...
You should use a radio transmitter like this.
Else, there is a great tutorial for communication using Bluetooth master & slave (warning: the post is in Italian).
If you still want to use SerialUSB, you should use a program that reads input from Nano and send a hex. code into Arduino Uno.
Library for serial communication with java or ruby.
Library for serial communication with Arduino.
I hope this can help you. Good luck!

ESP8266 Point to Point communication with 2 arduinos

I am using 2 esp8266 wireless modules to establish bidirectional wireless communication between 2 arduino boards (one mega and one uno) without the use of any earth based technologies (i.e. radio frequencies, wifi which relies on earth sattelites, etc.). My solution was to use the esp8266 to establish a private area network with both esp's acting as a station and an access point (AT+CIPMODE=3). Unfortunately, this solution has proven to be more of a hassle than it was worth.
To start, I have the esp's each wired according to this diagram
When I first started out, the red LED was on and the blue LED was off. During this time, I was able to send AT commands, establish the server, and achieve the communication I required by entering commands directly to the serial monitor. After this, I started writing a library using the SoftwareSerial library to allow me to issue commands directly through the program to set up the esp as needed upon start up of my script. Before doing this, I changed the baudrate to make sure it was running at 9600, and entered the AT commands in the serial monitor to make sure everything was working properly and it still worked.
After I began writing the library, before uploading the code with a test of the library I noticed the blue LED was lit solid now. Noticing this, I reuploaded the barebones script (I haven't uploaded the library code to the arduino yet) and the esp was no longer receiving the AT commands.
Does this indicate an issue with the board which I can fix or does this mean the board is done?
With my deadlines approaching fast in about 3 weeks it is crucial I get this wireless communication working so if this is an issue with the board, I'm going to have to scrap the esp's and use a different way of communicating. So my second question is, if this is the case, what are other viable options for establishing this communication? I have used xbee's before and while that would be ideal, they fall out of the budget I have been alotted so I need to keep it under $50 for this. If bidirectional communication is not possible for that price I can live with one way because I just need to get this system working. Basically I just need to transmit a single byte of data.
I realize this response is a little belated, and I hope you got it sorted: I've started working with the ESP8266 myself in the last few weeks, and hence why I was looking around for tutorials on direct communication between 2 units, when I found your post.
From what I've been able to ascertain, the AT commands are a part of the 'firmware' which ships with some modules. The Arduino code however starts loading onto the chips at memory address 0x0000, which is the same address that the firmware update tools use.
In other words, I believe that with the Arduino-coded program running on there, you lose the AT command functionality.
If you find a firmware update tool for the ESP8266 (plenty online) you'll get back the AT commands.
I suppose though the real question is why would you want to? It seems that the AT commands are just a way to treat the ESP as a dumb WiFi antenna. With the Arduino code, you're actually treating it as a micro-controller in its own right.

Arduino Standalone

I have an Arduino Uno and I am using arduino 1.0.5 IDE. I followed he procedures for bootloading an atmega328P-PU on a breadboard.
I uploaded the ArduinoISP sketch first, made the connections(using the External Oscillator) and then wired it up. Then, I selected the programmer as Arduino as ISP, selected the board as Arduino duemilanove w/ Atmega328P. Then I selected the correct serial port and clicked Burn Bootloader.
I got the following errors:
avrdude.exe: stk500_program_enable(): protocol error, expect=0x14,
resp=0x50avrdude.exe: initialization failed, rc=-1 Double
check connections and try again, or use -F to override
this check.avrdude.exe: stk500_disable(): protocol error, expect=0x14,
resp=0x51
How to solve this issue? Also, can I upload the bootloader directly by using it on the Uno in place of the original chip. If so, how?
to my understanding the error you have indicates a bad reading from the chip. I experienced that with chips that were either dead or not properly connected, especially to power supply.
You may find more detailed information in th tutorial : https://www.arduino.cc/en/Tutorial/ArduinoISP
Especially those things :
Note for Arduino 1.0: you need to make one small change to the
ArduinoISP code. Find the line in the heartbeat() function that says
"delay(40);" and change it to "delay(20);".
Select the items in the
Tools > Board and Serial Port menus that correspond to the board you
are using as the programmer (not the board being programmed).
Instead of arduino built-in boot loader just go through below link and it will be great for uploading boot loader and verifying board status info
I am replying you this because same issue I got long back and it saved me.
One more thing for arduino boot loader: for atmega328 you need to put capacitor between reset and gnd( in case you missed)
For gammon bootloader you don't need it.
Be Innovative.
For reset line you might me using 100nf(thats what stated in documentation )...but sometimes it doesn't work...try something like 4.7uf, 22uf or 47uf or close values
I had a similar problem and the issue was that my programmer was a bit slow, I used the -B flag for avrdude to slow down the bitrate and it started working, I set the -B20 and works like a charm every time, but I use the USBTinyISP programmer, not the stk500 one, so this might not work for you.
In case someone stuck at this as I did and nothing like changing the cap value helped. Make sure you are using your USB-TTL adapter in a 5v mode (obviously for a 5v powered chip). I always used it in a 3.3v mode in order not to accidentally burn my 3.3v chips and it always worked. Until today, I was trying to flash my custom atmega8 board and everything worked with the ISP but I was having a hard time using the bootloader and after half a day searching and trying different stuff the 5v setting to the rescue.

Serial Output to Arduino LED Display

I recently completed this project with my Arduino (a fairly new hobby for me):
http://www.instructables.com/id/Make-a-24X6-LED-matrix/?ALLSTEPS
I can change the code to make whatever messages I want scroll accross the matrix but I thought it might be cool to have live information, like stock quotes, scroll accross. I think I could figure out how to do that except I would like to use it at work where there are lots of firewalls in place and I doubt Arduino software is on the approved list of programs. Is it possible to send messages to the Arduino through a USB without installing any drivers?
No it is impossible because data in Arduino is sent via serial command, the USB is only for convenience, but arduino work with FTD driver that emulate a serial connection. You should choose another type of connection bluetooth or wifi.
Hope this help you.

Resources