GPIO lines

This article explains how to manage the general purpose input output (GPIO) lines on the CORE9G25 boards

All the examples are written in Python using the ablib module available on our CD. With this library it is possible to manage the GPIO using directly the board pin names.

CORE9G25 examples

Using this basic example of wiring:

CORE9G25 gpio example

it is possible to define the W9 line as an output and turn on/off the red led with the following code:

from ablib import Pin

led = Pin('W9','OUTPUT')

to read the button state it is possible to follow two methods:

  • Polling mode
  • Event mode

Polling mode

This mode consists to check the actual state of the line calling the get_value() method.

from ablib import Pin


#Never ending loop
while True:
    if (PB.digitalRead()==0):
        print "Pressed"
        while digitalRead()==0:

Event mode

This mode consists to register a callback function with the set_edge() method that will call when the GPIO lines changes its state.

from ablib import Pin
from time import sleep

def pressed():
    print "Pressed"


#Never ending loop
while True:
    print i

One of three conditions can be checked:

  • falling: the callback function is called when the signal goes from 1 to 0
  • rising: the callback function is called when the signal goes from 0 to 1
  • both: the callback function is called on any status change

Related links


Documentation Terms of Use
The Acme Systems srl provides this Debian system development and user manual.
The origin of these doc came from the website:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Creative Commons License

关注我们: 微博

销售电话: +86-755-29638421

Copyright @ 2014 to 2020 - 核风智能技术有限公司