Generating sin wave output values to serial port

Good evening to you all.

Forgive me, my first day with processing on windows and looking for some pointers to get me started.

I have 8 bit DtoA converters connected to my serial port that take an 8 bit address and 8 bit values to set the analog voltages.

First of all, is it possible using processing to send out sin wave values to the DtoA’s.

The baud rate is 19600 and the format is very basic address,value ( both are bytes )

I am looking at very slowly like three seconds per cycle going from 0 to 255 also having a control over the frequency, amplitude and phase of the two outputs. Phase being the difference in time from one wave to the other, ie the second wave value is at 255 when the first is at 128 but in a variable way called phase_shift.

Thank you.

Hi and welcome

Yes you can communicate with Arduino via processing serial library

Hi Sir
Before you start to send sin or whatever you want you may need to start by learning more about processing and Arduino browsing YouTube and google you find more examples how to start

Using serial data isn’t something new for me, been using MCUs for 30 years. Just the Sin functions and processing are new.

Looking at processing as a modern alternative to using vb or Delphi.

Asking for guidance to determine if I spend more time with processing which has good cross platform support.

I did have a look at the video, it is useful to perform communication testing between processing and the Arduino so thanks for sharing it. Interesting comment that the Arduino editor is made with processing. One of the things I was wondering was about adding a menu to a project.

I actually use my own developed boards based on atmega128s that do pretty much the same task as the Arduino.

One of the things I was wondering was about adding a menu to a project.

The following source code will place a menuBar in the default Processing window. This one uses .awt component. Can also be done with a Swing component.

import java.awt.*;
import java.awt.event.*;

java.awt.Frame frame;

void setup() {
  size(400, 400);
  frame = ((processing.awt.PSurfaceAWT.SmoothCanvas) ((processing.awt.PSurfaceAWT)surface).getNative()).getFrame();

  MenuBar menubar = new MenuBar();
  Menu    menu = new Menu("File");
  MenuItem open = new MenuItem("Open");
  MenuItem save = new MenuItem("Save");

  open.addActionListener(new ActionListener() {
    void actionPerformed(ActionEvent evnt) {
      println("open selected");

  save.addActionListener(new ActionListener() {
    void actionPerformed(ActionEvent evnt) {
      println("save selected");

void draw() {
  circle(100, 100, 100);

1 Like

Thank you Svan, that made it simple.