Skip to content

Week 14: Interface and Application Programming

Group assignment:

Compare as many tool options as possible.

Document your work on the group work page and reflect on your individual page what you learned.

Individual assignment:

Write an application that interfaces a user with an input and/or output device(s) on a board that you made

Group assignment:

For the group assignment we had to connect with our colleagues Hans, Maria Angel, Silvana from Lima and with our friend Ronal from Huanuco and the group page is:

Practicing Processing

We download and install the Processing software to carry out the practice

We have done the programming and we apply play and we move the course on the screen and the colors change as we move the mouse

Here we program where we move the mouse and the circle copies the movement

Individual assignment:

We carry out the test first on our arduino and connect with the potentiometer as follows

Once Arduino is open we have to write the following code and make sure that Arduino is sending the analog signal from the potentiometer through the serial port.

╔════════════════════════════════════════════════════════════════════╗ void setup()

{ Serial.begin(9600); } void loop() {

int valorPotenciometro = analogRead(A0);

Serial.println(valorPotenciometro);

delay(100); // Ajusta el tiempo según sea necesario

} ╚════════════════════════════════════════════════════════════════════╝ We observe that the values ​​are low

We observe that the values ​​are high since the potentiometer is moving

We make the connection with the arduino and the board

Once we have sent the analog signal we can close Arduino and open processing

We verify that when we increase the level of the potentiometer, the values ​​increase in the interface.

We open gpt chat so that you can help us and we write the text that we are going to program

We verify that we get the code, we copy it to the processing software

We connect the XIAO ESP32 3C board with the processing software and the potentiometer and we press play. We verify that when we move the potentiometer the ball also moves from left to right

Working with XIAO RP2040 board, Arduino software and Processing

The objective of this practice is that we will move the ball from left to right with our potentiometer in the processing software, using our board that we have built in assignment 8, we will add our XIAO RP2040.

STEP 1: We connect our XIAO RP2040 and our potentiometer to the board

STEP 2: We open the Arduino software and write the code to read the voltage provided by the potentiometer in real time, turning the value close to o to one end and the value close to 1023 to the other end.

STEP 3: We enter chatgp where we request create a code in the processing software to control the position of a ball using the SERIAL PORT through an electronic component that is the potentiometer and with the XIAO RP2040 that does work with the Arduino software that takes values ​​from 0 to 1023

In summary, the code allows us to control the horizontal position of a ball in a Processing window, using the values ​​sent from a potentiometer connected to a microcontroller such as the Arduino or the Seeed XIAO RP2040 through the serial port. The ball moves from left to right depending on the potentiometer value (range from 0 to 1023)

STEP 4: Open processing but first close the Arduino serial monitor, so that the port with processing is connected, once we have copied the code we play and move the potentiometer here we observe that the ball also moves from left to right and from right to left

Files:

movement_with_potentiometer_rp2040

serial port with arduino and RP2040


Last update: January 21, 2025