• 07/14/2017
  • Public Content


The example code for GPIO on mraa usage with C++ can be found from: https://github.com/intel-iot-devkit/joule-code-samples/tree/master/exploring-cpp/lesson_2_gpio
Example of using LEDs in Python:
To turn on LED100:
root@intel-corei7-64:~# python Python 2.7.12 (default, Dec 27 2016, 18:31:23) [GCC 5.4.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import mraa >>> led = mraa.Gpio(100) >>> led.dir(mraa.DIR_OUT) >>> led.write(1)
To show LEDs rotating, generate file
import mraa import time
def main():
 # Define the leds from expansion board
 leds = [mraa.Gpio(100), mraa.Gpio(101), mraa.Gpio(102), mraa.Gpio(103)]
 for led in leds:
 led.dir(mraa.DIR_OUT) # set GPIO to be output
 for led in leds:
 led.write(1) # set led on
 print("Led" + str(leds.index(led))+" status: " + str(led.read()))
 led.write(0) # set led off
 print("Led" + str(leds.index(led))+" status: " + str(led.read())) if __name__ == "__main__": main()
Then run from command line:
root@intel-corei7-64:~# python leds.py
Press ctrl-c to stop.

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804