1

I am working a graphical blocks for Scilab (software similar to MATLAB) simulation environment. There should be blocks called AI (analogue input), AO, DO. Also, there will be two programs: 1) on the side of Scilab, one which sends and receives data; 2) on the side of Arduino, one which sends and receives data.

Right now I am working on Arduino side code. It, the code, should read voltage values from 6 inputs and sends them to Scilab via serial and simultaneously write 1/0 to its outputs when it gets data from Scilab. In my understanding, data sent/received should have information about pin number (to know what pin it should affect) and value itself. Also, it should read and receives at the same time.

Any ideas how I could do it? Help would be much appreciated. Thank you.

1 Answer 1

1

You could use a timer interrupt to read the values and send them via serial and handle the commands from Scilab in loop() as usual.

I'm not 100% sure whether there could be problems from possibly being interrupted while in Serial.read(). In this case you might have to disable interrupts while reading the request (check before with Serial.available() whether there's something to read).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.