Demo 1: Analog and Digital - Debugging Arduino Logic - Arduino Development for OSX and iOS (2015)

Arduino Development for OSX and iOS (2015)

5. Debugging Arduino Logic

5.3 Demo 1: Analog and Digital

In this demo, we try to measure digital and analog output on Arduino board. I use Ikalogic tool for testing.

5.3.1 Ika Logic Installation

You can download ScanaStudio from http://www.ikalogic.com . Install and follow the installation process.

ch6-6

After finished, you can run ScanaStudio tool and select your tool model

ch6-3

Now you're ready to measure Arduino pins.

5.3.2 Wiring

In this demo, I use Arduino Uno so you can connect your Arduino to Ikalogic as follows.

· Digital pin 8 Arduino to channel 1 Ikalogic

· Analog A0 Arduino to channel 2 Ikalogic

· GND Arduino to channel GND Ikalogic

The following is my hardware wiring.

ch6-7

5.3.3 Writing Arduino Software

Now you can write a program for Arduino to simulate digital and analog output on Arduino pins.

Write these codes.

int digital_pin = 8;

int dac = 0;

void setup() {

pinMode(digital_pin,OUTPUT);

}

void loop() {

analogWrite(A0, dac);

if(dac<50 || (dac>100 && dac <180) || dac>200)

digitalWrite(digital_pin, HIGH);

else

digitalWrite(digital_pin, LOW);

dac = dac + 10;

if(dac>255)

dac = 0;

delay(10);

}

Save and upload the program to Arduino board.

5.3.4 Testing

On ScanaStudio, we do the following configuration on Configure panel

· Trigger type : No trigger

· Sampling rate: 100 KHz

· N. of Samples: 261888

After configured, you can click Start button to retrieve inputs from Arduino board.

A sample output can be seen in Figure below.

ch6-4