Arduino-compatible LIGHT

Warning message

The Propeller Object Exchange system is decommissioned and replaced with a GitHub repository to house the same existing and future Propeller objects. As of 12/5/2019, this site is read-only. You can continue to browse and download objects from here for a limited time; however, please begin using the Parallax Propeller repository for future reference.
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Request group membership
By: created: 2011-11-29 | updated: 2013-05-02


This is a basic _light_ implementation of the Arduino SDK for the Propeller and does not require a dedicated COG. It is intended for newbies to get acquainted with the Propeller. There are many useful SDK functions implemented, things like PWM, tones, shiftIn/shiftOut, bit setting routines and math routines. This object is intended as an easy way for Arduinites to explore the Propeller, it is not intended as a substitute for the many great SPIN/PASM objects that implement much of these functions in a more robust and thorough manner.
12/07/2011: added note constants to CON section, see note_player.spin example added sound file player example snd_player.spin
12/05/2011: fixed compile failure in random() declaration
The following functions are implemented:
  • pinMode()
  • digitalWrite()
  • digitalRead()
  • millis()
  • micros()
  • delay()
  • delayMicroseconds()
  • _min()
  • _max()
  • _abs()
  • constrain()
  • map()
  • pow()
  • sqrt()
  • sin()
  • cos()
  • tan()
Bits and Bytes
  • lowByte()
  • highByte()
  • bitRead()
  • bitWrite()
  • bitSet()
  • bitClear()
  • bit()
Advanced I/O
  • tone()
  • noTone()
  • shiftIn()
  • shiftOut()
  • pulseIn()
Analog I/O
  • analogWrite()
Random Numbers
  • randomSeed()
  • random()
Differences between this _light_ implementation and the Arduino:
millis() and micros() overflow every ~54 seconds because the system
counter runs at clock speed (usually 80Mhz) and is 32 bits
tone() does not have a duration option, so you must call noTone() to turn
off the output. This function also accepts frequencies larger than 65536.
digitalWrite() does not operate at 500Hz, it uses a hardware counter that
operates at the main clock frequency, which is usually 80Mhz.
pow() and sqrt() are integer only, for floating point functions see the Float32, Float32, and FloatFull objects.
attachInterrupt(), detachInterrupt(), interrupts(), and noInterrupts()
are not implemented because the Propeller does not have interrupts.
Propeller programming convention is to use multiple COGs where you might
have used interrupts in a conventional mCu architecture.
sin(), cos(), and tan() take degrees and radius, instead of radians. This format does not require degree to radian conversion and subsequent radius multiplication. The result is a signed value with a range of +- radius.
analogRead() and analogReference() are not implemented, the Propeller does not have embedded ADC hardware, either an external ADC chip is needed or you can use Sigma-Delta ADC with the ADC SPIN object included in the Propeller Development Kit, or the MCP3208 object which interfaces to an external ADC chip via SPI.
Original File Upload
Binary Data Arduino_light_5.spin7.07 KB
Package icon Auxiliary files.zip15.44 KB