bixie Posted August 28, 2019 Share Posted August 28, 2019 Here you'll find my code, the thing is the 2 try isn't exporting the files, and I am not able to figure out the reason. Please help. --- if(!('Impedance1' in this)) throw "Please open the Impedance1 instrument"; if(!('Supplies' in this)) throw "Please open the Supplies instrument"; if(!('StaticIO' in this)) throw "Please open the StaticIO instrument"; //Impedance Settings Impedance1.Frequency.Samples.value=51 Impedance1.Frequency.Start.value=1 Impedance1.Frequency.Stop.value=100000 Impedance1.Wavegen.Amplitude.value=0.2 Impedance1.Resistor.resistor=100 //Supplier Settings Supplies.Output.PositiveSupply.Voltage.value=5 Supplies.Output.NegativeSupply.Voltage.value=-5 Supplies.Output.PositiveSupply.Enable.value=1 Supplies.Output.NegativeSupply.Enable.value=1 Supplies.run() for(var c = 0; c < 8; c++){ StaticIO.Channel0.DIO[c].Mode.text = "Switch"; //dd=Date() //folder=print(dd) Index=1 //My Addition dt 23.08.19 ---ST-- //const Index = 1 function dir(){ var now = new Date(), year = '' + (now.getFullYear()), month = '' + (now.getMonth() + 1), day = '' + now.getDate(), hour = '' + now.getHours(); if (year.length < 2) year = '0' + year; if (month.length < 2) month = '0' + month; if (day.length < 2) day = '0' + day; if (hour.length < 2) hour = '0' + hour; var dirbase = "~/Desktop/TEERvalues/"+year+" "+month+" "+day+"/"+hour for(var i = 0; i < 1000; i++){ var dirname = dirbase; if(i!=0) dirname += " "+i; var test = File(dirname) var exists = test.exists(); delete test; if(!exists) return dirname; } return ""; } var filename = dir()+"/Messung"+Index+".png"; var filenametxt = dir()+"/Messung"+Index+".txt"; //My Addition dt 23.08.19 --END-- StaticIO.run() // 1.Probe print("Running pin 1, channel 1") StaticIO.Channel0.DIO[3].text = "0"; StaticIO.Channel0.DIO[4].text = "1"; StaticIO.Channel0.DIO[5].text = "1"; StaticIO.Channel0.DIO[0].text = "0"; StaticIO.Channel0.DIO[1].text = "0"; StaticIO.Channel0.DIO[2].text = "0"; Impedance1.single() wait(120) Impedance1.Export("~/Desktop/SeeIfIWork/und/Messung"+Index+".png") Impedance1.Export(filename) Impedance1.Export(filenametxt) // Impedance1.Export("~/Desktop/Bachelor Arbeit/Bilder/Messung"+Index+".png") Index++ // 2.Probe print("Running pin 2, channel 2") StaticIO.Channel0.DIO[3].text = "0"; StaticIO.Channel0.DIO[4].text = "1"; StaticIO.Channel0.DIO[5].text = "1"; StaticIO.Channel0.DIO[0].text = "1"; StaticIO.Channel0.DIO[1].text = "0"; StaticIO.Channel0.DIO[2].text = "0"; Impedance1.single() wait(120) //Impedance1.Export("~/Desktop/SeeIfIWork/"dd+MM+yy"/Messung"+Index+".png") Impedance1.Export(filename) Impedance1.Export(filenametxt) Index++ Link to comment Share on other sites More sharing options...
JColvin Posted August 28, 2019 Share Posted August 28, 2019 Hi @bixie, I have moved your question to a more appropriate section of the forum where the Digilent engineer more familiar with WaveForms and WaveForms SDK will be able to see and respond to your question. Thank you, JColvin Link to comment Share on other sites More sharing options...
bixie Posted August 28, 2019 Author Share Posted August 28, 2019 Just now, JColvin said: Hi @bixie, I have moved your question to a more appropriate section of the forum where the Digilent engineer more familiar with WaveForms and WaveForms SDK will be able to see and respond to your question. Thank you, JColvin Thanks! Let’s hope the issue is fixed ? Link to comment Share on other sites More sharing options...
bixie Posted August 30, 2019 Author Share Posted August 30, 2019 @attila Could you please help? Link to comment Share on other sites More sharing options...
attila Posted September 2, 2019 Share Posted September 2, 2019 You can find the answer to the same question here: Link to comment Share on other sites More sharing options...
Question
bixie
Here you'll find my code, the thing is the 2 try isn't exporting the files, and I am not able to figure out the reason. Please help.
---
if(!('Impedance1' in this)) throw "Please open the Impedance1 instrument";
if(!('Supplies' in this)) throw "Please open the Supplies instrument";
if(!('StaticIO' in this)) throw "Please open the StaticIO instrument";
//Impedance Settings
Impedance1.Frequency.Samples.value=51
Impedance1.Frequency.Start.value=1
Impedance1.Frequency.Stop.value=100000
Impedance1.Wavegen.Amplitude.value=0.2
Impedance1.Resistor.resistor=100
//Supplier Settings
Supplies.Output.PositiveSupply.Voltage.value=5
Supplies.Output.NegativeSupply.Voltage.value=-5
Supplies.Output.PositiveSupply.Enable.value=1
Supplies.Output.NegativeSupply.Enable.value=1
Supplies.run()
for(var c = 0; c < 8; c++){
StaticIO.Channel0.DIO[c].Mode.text = "Switch";
//dd=Date()
//folder=print(dd)
Index=1
//My Addition dt 23.08.19 ---ST--
//const Index = 1
function dir(){
var now = new Date(),
year = '' + (now.getFullYear()),
month = '' + (now.getMonth() + 1),
day = '' + now.getDate(),
hour = '' + now.getHours();
if (year.length < 2) year = '0' + year;
if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;
if (hour.length < 2) hour = '0' + hour;
var dirbase = "~/Desktop/TEERvalues/"+year+" "+month+" "+day+"/"+hour
for(var i = 0; i < 1000; i++){
var dirname = dirbase;
if(i!=0) dirname += " "+i;
var test = File(dirname)
var exists = test.exists();
delete test;
if(!exists) return dirname;
}
return "";
}
var filename = dir()+"/Messung"+Index+".png";
var filenametxt = dir()+"/Messung"+Index+".txt";
//My Addition dt 23.08.19 --END--
StaticIO.run()
// 1.Probe
print("Running pin 1, channel 1")
StaticIO.Channel0.DIO[3].text = "0";
StaticIO.Channel0.DIO[4].text = "1";
StaticIO.Channel0.DIO[5].text = "1";
StaticIO.Channel0.DIO[0].text = "0";
StaticIO.Channel0.DIO[1].text = "0";
StaticIO.Channel0.DIO[2].text = "0";
Impedance1.single()
wait(120)
Impedance1.Export("~/Desktop/SeeIfIWork/und/Messung"+Index+".png")
Impedance1.Export(filename)
Impedance1.Export(filenametxt)
// Impedance1.Export("~/Desktop/Bachelor Arbeit/Bilder/Messung"+Index+".png")
Index++
// 2.Probe
print("Running pin 2, channel 2")
StaticIO.Channel0.DIO[3].text = "0";
StaticIO.Channel0.DIO[4].text = "1";
StaticIO.Channel0.DIO[5].text = "1";
StaticIO.Channel0.DIO[0].text = "1";
StaticIO.Channel0.DIO[1].text = "0";
StaticIO.Channel0.DIO[2].text = "0";
Impedance1.single()
wait(120)
//Impedance1.Export("~/Desktop/SeeIfIWork/"dd+MM+yy"/Messung"+Index+".png")
Impedance1.Export(filename)
Impedance1.Export(filenametxt)
Index++
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.