hippy
Posts: 5964
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Mon May 27, 2019 7:28 pm

I don't really have the time to divert to that, but this should give you the basics. This is part of my test code in Python -

Code: Select all

result = GPIO.enter()
if result != 0:
  print("Initialised : " + str(result) + " Failed")
else:
  print("Initialised : " + str(result) + " Success")
  pin = 0
  print("Pulsing GPIO"+str(pin))
  GPIO.setAlt(pin, GPIO.ALT_OUTPUT) # Make pin an output
  for count in range(0,10): # Send 10 pulses
    GPIO.setPin(pin, 1) # Set High
    GPIO.setPin(pin, 0) # Set Low
  GPIO.leave()
print("Finished")
Change the method names and that should work with your ScriptBasic library.

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon May 27, 2019 7:30 pm

THANK YOU!!!

How do I see the resulting output? (temp / humidity)

hippy
Posts: 5964
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Mon May 27, 2019 11:44 pm

ScriptBasic wrote:
Mon May 27, 2019 7:30 pm
How do I see the resulting output? (temp / humidity)
Presumably you will need some code to interact with whatever chip you have, and that will depend on which chip you have, what GPIO it connects to.

I am currently only interested for now in getting the GPIO pins controlled. That can be done by setting registers and checking things are the same as other GPIO reporting tools are showing. For actual physical checking I'll just be using a meter and looking at changing signals with a logic analyser.

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon May 27, 2019 11:59 pm

I'm starting to get it.

Most examples I've seen for sensor interfaces are based on WiringPi. I'm assuning that is just another GPIO wrapper?

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Wed May 29, 2019 5:18 am

I gave the Kookey examples a try for the DHT11 Temperature and Humidity sensor. The C example never returned anything other than Data not good, skip. The Python example returns a result about 1 out of 4 times.

DHT11 C

Code: Select all

/*
 *  dht11.c:
 *  Simple test program to test the wiringPi functions
 *  DHT11 test
 */

#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define MAXTIMINGS  85
#define DHTPIN    14
int dht11_dat[5] = { 0, 0, 0, 0, 0 };

void read_dht11_dat()
{
  uint8_t laststate = HIGH;
  uint8_t counter   = 0;
  uint8_t j   = 0, i;
  float f; /* fahrenheit */

  dht11_dat[0] = dht11_dat[1] = dht11_dat[2] = dht11_dat[3] = dht11_dat[4] = 0;

  /* pull pin down for 18 milliseconds */
  pinMode( DHTPIN, OUTPUT );
  digitalWrite( DHTPIN, LOW );
  delay( 18 );
  /* then pull it up for 40 microseconds */
  digitalWrite( DHTPIN, HIGH );
  delayMicroseconds( 40 );
  /* prepare to read the pin */
  pinMode( DHTPIN, INPUT );

  /* detect change and read data */
  for ( i = 0; i < MAXTIMINGS; i++ )
  {
    counter = 0;
    while ( digitalRead( DHTPIN ) == laststate )
    {
      counter++;
      delayMicroseconds( 1 );
      if ( counter == 255 )
      {
        break;
      }
    }
    laststate = digitalRead( DHTPIN );

    if ( counter == 255 )
      break;

    /* ignore first 3 transitions */
    if ( (i >= 4) && (i % 2 == 0) )
    {
      /* shove each bit into the storage bytes */
      dht11_dat[j / 8] <<= 1;
      if ( counter > 16 )
        dht11_dat[j / 8] |= 1;
      j++;
    }
  }

  /*
   * check we read 40 bits (8bit x 5 ) + verify checksum in the last byte
   * print it out if data is good
   */
  if ( (j >= 40) &&
       (dht11_dat[4] == ( (dht11_dat[0] + dht11_dat[1] + dht11_dat[2] + dht11_dat[3]) & 0xFF) ) )
  {
    f = dht11_dat[2] * 9. / 5. + 32;
    printf( "Humidity = %d.%d %% Temperature = %d.%d *C (%.1f *F)\n",
      dht11_dat[0], dht11_dat[1], dht11_dat[2], dht11_dat[3], f );
  }else  {
    printf( "Data not good, skip\n" );
  }
}

int main( void )
{
  printf( "Raspberry Pi wiringPi DHT11 Temperature test program\n" );

  if ( wiringPiSetup() == -1 )
    exit( 1 );

  while ( 1 )
  {
    read_dht11_dat();
    delay( 1000 ); /* wait 1sec to refresh */
  }

  return(0);
}
DHT11 Python

Code: Select all

# _____ _____ _____ __ __ _____ _____ 
#|     |   __|     |  |  |     |     |
#|  |  |__   |  |  |_   _|  |  |  |  |
#|_____|_____|_____| |_| |_____|_____|
#
# Use Raspberry Pi to get temperature/humidity from DHT11 sensor
#  
import time
import dht11
import RPi.GPIO as GPIO

#define GPIO 14 as DHT11 data pin
Temp_sensor=14
def main():
  # Main program block
  GPIO.setwarnings(False)
  GPIO.setmode(GPIO.BCM)       # Use BCM GPIO numbers
  # Initialise display
#  lcd_init()
  instance = dht11.DHT11(pin = Temp_sensor)

  while True:
        #get DHT11 sensor value
        result = instance.read()
        print"Temperature = ",result.temperature,"C"," Humidity = ",result.humidity,"%"
        time.sleep(1)

if __name__ == '__main__':

  try:
    main()
  except KeyboardInterrupt:
    pass
#  finally:
#    lcd_byte(0x01, LCD_CMD)
Python Output

Code: Select all

[email protected]:~/sensors $ sudo python ./dht11-test.py
Temperature =  23 C  Humidity =  58 %
Temperature =  0 C  Humidity =  0 %
Temperature =  0 C  Humidity =  0 %
Temperature =  0 C  Humidity =  0 %
Temperature =  23 C  Humidity =  58 %
Temperature =  0 C  Humidity =  0 %
Temperature =  0 C  Humidity =  0 %
^[email protected]:~/sensors $ 

hippy
Posts: 5964
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Wed May 29, 2019 5:28 pm

From what I recall of the DHT11 it's a real PITA to drive having a single bi-directional, self-clocked signalling system requiring microsecond timing to make it work. A badly-timed interrupt, context switch or stall, which interferes with that will cause missed data and corruption, and that's likely to happen on a system like Linux.

That some of the readings you get under Python are reasonable and consistent suggests that's working and you are seeing the effects of those corruptions. I would imagine the Python module simply zeroes corrupt data, rather than just trying again or delivering corrupt data. It is probably as good as it gets.

It is perhaps better to start with some hardware which is more reliable, not so timing sensitive. I'm not sure what hardware you have but anything I2C or SPI should be easier to use.

1-wire devices ( eg DS18B20 temperture sensors ) also have very specific timing requirements. I don't know how the 1-wire filing system deals with that, but I wouldn't expect to get reliable results from Linux userland.

One of the things I am hoping to do is get GPIO interrogating code running in the VideoCore which will hopefully be more immune to what else is going on. But that's another project which is on hold at present.

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Wed May 29, 2019 8:51 pm

Thanks for the feedback!

I was beginning to wonder if wiringPi was the issue. Strange I can't get the C version to work.

I have the Kookey home automation kit which gives me 16 various sensors. My luck I would start off with one of the more difficult to interface with. The temp/ humidity sensor on the Pi Astro SenseHAT board via i2c seemed to return consistant data.

This GPIO interface has more variations than BASIC if that is possible.

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Wed May 29, 2019 9:56 pm

I found an alternative Python solution which uses rpi.gpio instead of wiringPi.

DHT11 Python

Output

Code: Select all

 [email protected]:~/sensors/DHT11_Python-master $ python ./dht11_example.py
Last valid input: 2019-05-29 14:47:15.592946
Temperature: 21 C
Humidity: 61 %
Last valid input: 2019-05-29 14:47:17.749721
Temperature: 21 C
Humidity: 61 %
Last valid input: 2019-05-29 14:47:19.902875
Temperature: 21 C
Humidity: 61 %
Last valid input: 2019-05-29 14:47:24.208627
Temperature: 21 C
Humidity: 61 %
Last valid input: 2019-05-29 14:47:26.361732
Temperature: 21 C
Humidity: 61 %
Last valid input: 2019-05-29 14:47:32.819661
Temperature: 21 C
Humidity: 61 %
Last valid input: 2019-05-29 14:47:34.972748
Temperature: 21 C
Humidity: 61 %
The good news is the GPIO extension module I built is based on the C code used in rpi.gpio. 8-)

I'm going to try to write the device GPIO code as native BASIC code as high level functions within the GPIO extension module.

User avatar
bensimmo
Posts: 4175
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: ScriptBasic

Thu May 30, 2019 9:45 am

if you are looking at Python code, you may want to look at Adafruit, much of their code is based around CircuitPython now, a micropython implementation, but makes it cross device compatible.
here is the dht11/22 code
https://github.com/adafruit/Adafruit_Ci ... uit_dht.py
Their older python setup is
https://github.com/adafruit/Adafruit_Python_DHT which iirc has some c code.

also a direct attempt at a kernel implementation, might be easier to read what is happening ?
https://github.com/edwardlintw/DHT22

User avatar
bensimmo
Posts: 4175
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: ScriptBasic

Thu May 30, 2019 9:57 am

Also for a look at the different PIN setups, gpiozero seems quite nice (RPi Python3 module) https://gpiozero.readthedocs.io/en/stable/api_pins.html

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Thu May 30, 2019 1:32 pm

Thanks for the links!

The goal is using ScriptBasic to write the device interfaces and the C code from rpi.gpio as the engine.

User avatar
RichardRussell
Posts: 579
Joined: Thu Jun 21, 2012 10:48 am

Re: ScriptBasic

Thu May 30, 2019 2:31 pm

ScriptBasic wrote:
Thu May 30, 2019 1:32 pm
The goal is using ScriptBasic to write the device interfaces and the C code from rpi.gpio as the engine.
For my education, what is it about ScriptBASIC that causes it to require C code to interface with the GPIO? Or does it? In the case of BBC BASIC the GPIO library (like every other) is entirely BASIC code itself, there is no need to offload anything to another language. These days I don't even make use of the built-in assembler, because that makes the code non-portable.

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Thu May 30, 2019 2:38 pm

ScriptBasic's FFI is its extension module API. I converted the C portion of the rpi.gpio library as an extension module. I hope to write the DHT11 interface in ScriptBasic calling the GPIO extension module. Get first valid reading and return.

FYI: I updated the first post in this thread to point to the ScriptBasic Resources on the RaspberryBASIC.org forum.

User avatar
bensimmo
Posts: 4175
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: ScriptBasic

Thu May 30, 2019 3:52 pm

As much as I prefer to use pigpio / pigpiod on the Pi (as it gives remote access to the pins) and seems to work really nicely.

It may be worth your time using wiringpi?, you may even be able to lift it out of RTB (it uses it, for somewhat obvious reasons ;-))
It might be a quicker route, it might not be as fun to learn though.

User avatar
RichardRussell
Posts: 579
Joined: Thu Jun 21, 2012 10:48 am

Re: ScriptBasic

Thu May 30, 2019 4:20 pm

ScriptBasic wrote:
Thu May 30, 2019 2:38 pm
ScriptBasic's FFI is its extension module API.
Yes, I know, but I just wondered what the rationale for that was. I appreciate that you didn't 'invent' ScriptBASIC so it's probably a design decision taken well before you got involved. From my perspective it seems odd that one has to use a different language (like C) to create the glue between ScriptBASIC and an external module such as a DLL or shared object, but it probably seems entirely natural to you!

hippy
Posts: 5964
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Thu May 30, 2019 4:51 pm

RichardRussell wrote:
Thu May 30, 2019 4:20 pm
From my perspective it seems odd that one has to use a different language (like C) to create the glue between ScriptBASIC and an external module such as a DLL or shared object, but it probably seems entirely natural to you!
The main rationale would be when the host language doesn't support direct pointer operations, for example "*(gpio+GPSET0+(pin/32)) = 1<<(pin%32)", so that has to be done in an extension written in a language which does.

Python doesn't, so anything needing access to memory needs an extension written in C.

Though having written that; I'm pondering what opening "/dev/gpiomem" actually allows, given one can access raw frame buffer data by opening "/dev/fb0".

The other rationale would be, where one can do it, but the doing of it is slow, because of the interpretive nature of the host language. That's what motivated me to write a C extension for copying a bitmap to a GPIO connected LCD. That takes a couple of seconds when bit-banged through Python using RPi.GPIO. My own extension should give me much shorter refresh times.

There's also the problem that, if an interpretive language is slow, it might not be fast enough to actually bit-bang the required signalling. For example, that DHT11 signalling works at about 100kHz and the interpreted code may run slower than that.

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Thu May 30, 2019 5:03 pm

I have yet to get any C example to work. Python is the only example code that works for me at the moment.

hippy
Posts: 5964
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Thu May 30, 2019 5:20 pm

ScriptBasic wrote:
Wed May 29, 2019 8:51 pm
This GPIO interface has more variations than BASIC if that is possible.
That's pretty much unavoidable. There may be a few protocols defined as standard for transferring data but, beyond that, it's like the wild west, everyone implementing their own register layouts with different schemes for configuring the chip and retrieving data.

Many chip designers design purely for microcontroller interfacing with no regard that systems running OS's and userland programs doing bit-banging might not have the determinism required to use their chips, or is a massive undertaking to achieve.

Many don't seem to consider whether what they implement will be easy to use or not, or whether there's a better, more useful, way to do things. Take the Pi's Bluetooth/WiFi chip; that's two chips mashed into one and, because of that, it requires a UART and an SDIO interface. It would have been so much more convenient if they'd found a way to tunnel the UART data over the SDIO bus meaning only one interface would be required.

And take the Pi SoC itself; why did Broadcom choose one full UART and one mini-UART rather than two full UART's, have its clock tied to a variable system frequency ?

I guess in most cases there will have been a rational reason. Even if just the usual 'do the minimum of what's needed' rather than 'cater for everything anyone might need', which takes longer, carries more cost, requires more effort, which is considered 'wasted' or 'pointless' when there's no necessity foreseen.

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Thu May 30, 2019 5:29 pm

If I could see a working C example for the DHT11, I might be able to get this extension module workong.

@hippy,

Do you have a C example that works?

User avatar
RichardRussell
Posts: 579
Joined: Thu Jun 21, 2012 10:48 am

Re: ScriptBasic

Thu May 30, 2019 5:38 pm

hippy wrote:
Thu May 30, 2019 4:51 pm
The main rationale would be when the host language doesn't support direct pointer operations, for example "*(gpio+GPSET0+(pin/32)) = 1<<(pin%32)", so that has to be done in an extension written in a language which does.
OK, I can understand that. I'm spoilt by a BASIC that does have those operations:

Code: Select all

      !(gpio + GPSET0 + pin DIV 32) = 1 << (pin MOD 32)
I think I remember you saying ScriptBASIC does too but that was probably via an extension module rather than the native language.
There's also the problem that, if an interpretive language is slow, it might not be fast enough to actually bit-bang the required signalling.
I guess I'll find that out when I try!

hippy
Posts: 5964
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Thu May 30, 2019 6:15 pm

ScriptBasic wrote:
Thu May 30, 2019 5:29 pm
Do you have a C example that works?
No; I've got no examples at all for interfacing with actual hardware boards or devices.

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Thu May 30, 2019 6:15 pm

Good Luck!

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Thu May 30, 2019 6:19 pm

hippy wrote:
Thu May 30, 2019 6:15 pm
ScriptBasic wrote:
Thu May 30, 2019 5:29 pm
Do you have a C example that works?
No; I've got no examples at all for interfacing with actual hardware boards or devices.
One would think if it works in Python, a C version should be a no brainer. I have tried 4 different C examples and none of them work.

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Thu May 30, 2019 8:38 pm

I have been trying to get the ScriptBasic GPIO extension module working with the DHT11 and this is where I'm at.

Code: Select all

' Test GPIO

IMPORT gpio.bas

status = GPIO::Setup()
GPIO::SetupGPIO(7,0,0)
GPIO::OutputGPIO(7,1)
GPIO::ShortWait()
GPIO::OutputGPIO(7,0)
GPIO::ShortWait()
GPIO::SetupGPIO(7,1,2)
FOR x = 1 to 100
  PRINT GPIO::InputGPIO(7),"\n"
NEXT

GPIO::Cleanup
I'm trying to emulate this Python code.

Code: Select all

class DHT11:
    'DHT11 sensor reader class for Raspberry'

    __pin = 0

    def __init__(self, pin):
        self.__pin = pin

    def read(self):
        RPi.GPIO.setup(self.__pin, RPi.GPIO.OUT)

        # send initial high
        self.__send_and_sleep(RPi.GPIO.HIGH, 0.05)

        # pull down to low
        self.__send_and_sleep(RPi.GPIO.LOW, 0.02)

        # change to input using pull up
        RPi.GPIO.setup(self.__pin, RPi.GPIO.IN, RPi.GPIO.PUD_UP)

        # collect data into an array
        data = self.__collect_input()

        # parse lengths of all data pull up periods
        pull_up_lengths = self.__parse_data_pull_up_lengths(data)

        # if bit count mismatch, return error (4 byte data + 1 byte checksum)
        if len(pull_up_lengths) != 40:
            return DHT11Result(DHT11Result.ERR_MISSING_DATA, 0, 0)

        # calculate bits from lengths of the pull up periods
        bits = self.__calculate_bits(pull_up_lengths)

        # we have the bits, calculate bytes
        the_bytes = self.__bits_to_bytes(bits)

        # calculate checksum and check
        checksum = self.__calculate_checksum(the_bytes)
        if the_bytes[4] != checksum:
            return DHT11Result(DHT11Result.ERR_CRC, 0, 0)

        # ok, we have valid data, return it
        return DHT11Result(DHT11Result.ERR_NO_ERROR, the_bytes[2], the_bytes[0])

    def __send_and_sleep(self, output, sleep):
        RPi.GPIO.output(self.__pin, output)
        time.sleep(sleep)

    def __collect_input(self):
        # collect the data while unchanged found
        unchanged_count = 0

        # this is used to determine where is the end of the data
        max_unchanged_count = 100

        last = -1
        data = []
        while True:
            current = RPi.GPIO.input(self.__pin)
            data.append(current)
            if last != current:
                unchanged_count = 0
                last = current
            else:
                unchanged_count += 1
                if unchanged_count > max_unchanged_count:
                    break

        return data
current returns 128 for each of my FOR/NEXT loop of 100 iterations.

The Python version starts off printing 1 and then a series of 1 and 0 then back to all 1 until 100 of them then the results print.

Code: Select all

[email protected]:~/sensors/DHT11_Python-master $ python dht11_example.py
0
1
1
0
0
0
1
1
0
0
0
0
1
1
0
0
0
1
1
1
1
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
1
1
0
0
0
1
1
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
1
1
1
0
0
0
1
1
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
0
1
1
0
0
0
1
1
1
1
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
0
0
0
1
1
1
1
1
0
0
0
0
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Last valid input: 2019-05-30 14:02:16.054323
Temprature: 71 F
Humidity: 59 %
[email protected]:~/sensors/DHT11_Python-master $ 

I never see my current value change from 128. I have tried (physical pin)7 (GPIO)4. Changing the pin to 4 in the above example returns the number 16 and never changes. I wonder if the 'shortdelay()' call of 150 cycles is too short for the sampling period.

User avatar
John_Spikowski
Posts: 1392
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Fri May 31, 2019 12:48 am

I have a microsecond sleep function in the SBT extension module so I used it for my delay calls. I tried it on both pin # GPIO4 and physical 7. No change. (4 = 16 and 7 = 255)

Code: Select all

' Test GPIO

IMPORT gpio.bas
IMPORT sbt.bas

status = GPIO::Setup()
GPIO::SetupGPIO(7,0,0)
GPIO::OutputGPIO(7,1)
SB_msSleep(50)
GPIO::OutputGPIO(7,0)
SB_msSleep(20)
GPIO::SetupGPIO(7,1,2)
s = 0
FOR x = 1 to 100
  PRINT GPIO::InputGPIO(7),"\n"
NEXT

GPIO::Cleanup

Return to “Other programming languages”