#!/usr/sbin/blassic ' /home/graham/i2c_ad-remote_plot-local/i2c_ad-remote_plot-local_1.bas 'clear the screen at the start SHELL "/home/graham/i2c_ad-remote_plot-local/PIC_i2c_send_data_to_plot_ram 81 file 0 50 1 1 0 1 0 0 0" PAUSE 1000 z = 0 LABEL GoAgain SHELL "/home/graham/i2c_ad-remote_plot-local/PIC_i2c_send_data_to_plot_ram 81 file 0 50 1 1 0 1 0 0 0" PAUSE 1000 for i = 0 to 100 ' z is used to flash the LED on PIN D4 to show it is running under Slug control if z = 0 THEN z$ = "0" if z = 1 THEN z$ = "1" 'get AtoD line 0 from the remote PIC at address 80 - (as 0 to 1023) 'and make the script save the raw value in /var/www/ramdisk/AD.txt SHELL "echo -n `/home/graham/i2c/PIC_i2c_one_ADnumber_only_a 80 0 0 "+z$+" 0 0 0`>/var/www/ramdisk/AD.txt" z = z + 1 if z = 2 then z = 0 'now transfer the stored value from bash to blassic here OPEN "/var/www/ramdisk/AD.txt" FOR INPUT AS #1 : INPUT #1,AD$ : CLOSE #1 'AD$ goes 0 to 1023 AD = VAL(AD$) 'convert string to number PRINT "AD raw value from ramdisk = ", AD AD$ = STR$(ROUND (AD/4)) PRINT "AD rounded string = ", AD$ ' put the 8 bit version into AD.txt on the ramdisk shell "echo -n "+AD$+" >/var/www/ramdisk/AD.txt" PRINT "i = ",i shell_command$ = "/home/graham/i2c_ad-remote_plot-local/PIC_i2c_send_data_to_plot_ram 81 file 0 "+STR$(i)+" 1 1 1 0 0 0 0" PRINT "shell command = ",shell_command$ SHELL shell_command$ PAUSE 1000 IF AD = 1023 THEN system NEXT i GOTO GoAgain system