Jump to content
  • 0

How to Send Signal to Arduino with Analog Discovery 2?


Mirandamay

Question

2 answers to this question

Recommended Posts

Hi @Mirandamay

You could use the WaveForms SDK. Starting with the AnalogIn_Record_int16.py or AnalogIn_Record.py example script and modifying it to send the data chunks from the record loop to the desired protocol (like COM), or using the device DIO (see Digital_Spi.py, Digital_Uart.py, Digital_I2c.py)
The examples are located in the following path: C:/Program Files (x86)/Digilent/WaveFormsSDK/samples/py/ 
image.png.0f88183b5798f461989d6d3eda2669f5.png

You could also send acquisition data over SPI with the WaveForms application like this:

image.thumb.png.9cd9a4660b5dd7cc9882b195e71307c7.png

Scope1.run()
while(Scope1.wait()){
    var rg16 = []
    var r = Scope1.Channel1.Range.value
    var o = Scope1.Channel1.Offset.value
    // convert float to 16bit integer
    Scope1.Channel1.alldata.forEach(function(v){
        rg16.push(max(-32768, min(32767, v*32768/r+o)))
    })
    Protocol.SPI.Start()
    if(!Protocol.SPI.Write(16, rg16)) break
    Protocol.SPI.Stop()
}

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...