summaryrefslogtreecommitdiff
path: root/peripheral/libupm/examples
diff options
context:
space:
mode:
Diffstat (limited to 'peripheral/libupm/examples')
-rw-r--r--peripheral/libupm/examples/c++/CMakeLists.txt260
-rw-r--r--peripheral/libupm/examples/c++/a110x-intr.cxx76
-rw-r--r--peripheral/libupm/examples/c++/a110x.cxx67
-rw-r--r--peripheral/libupm/examples/c++/ad8232.cxx65
-rw-r--r--peripheral/libupm/examples/c++/adafruitms1438-stepper.cxx82
-rw-r--r--peripheral/libupm/examples/c++/adafruitms1438.cxx75
-rw-r--r--peripheral/libupm/examples/c++/adafruitss.cxx77
-rw-r--r--peripheral/libupm/examples/c++/adc121c021.cxx66
-rw-r--r--peripheral/libupm/examples/c++/adis16448.cxx66
-rw-r--r--peripheral/libupm/examples/c++/ads1x15.cxx320
-rw-r--r--peripheral/libupm/examples/c++/adxl335.cxx78
-rw-r--r--peripheral/libupm/examples/c++/adxl345.cxx51
-rw-r--r--peripheral/libupm/examples/c++/adxrs610.cxx71
-rw-r--r--peripheral/libupm/examples/c++/ak8975.cxx72
-rw-r--r--peripheral/libupm/examples/c++/am2315.cxx75
-rw-r--r--peripheral/libupm/examples/c++/apds9002.cxx62
-rw-r--r--peripheral/libupm/examples/c++/apds9930.cxx63
-rw-r--r--peripheral/libupm/examples/c++/at42qt1070.cxx90
-rw-r--r--peripheral/libupm/examples/c++/biss0001.cxx68
-rw-r--r--peripheral/libupm/examples/c++/bma220.cxx70
-rw-r--r--peripheral/libupm/examples/c++/bmpx8x.cxx80
-rw-r--r--peripheral/libupm/examples/c++/buzzer-sound.cxx54
-rw-r--r--peripheral/libupm/examples/c++/cjq4435.cxx77
-rw-r--r--peripheral/libupm/examples/c++/dfrph.cxx76
-rw-r--r--peripheral/libupm/examples/c++/ds1307.cxx77
-rw-r--r--peripheral/libupm/examples/c++/eboled.cxx49
-rw-r--r--peripheral/libupm/examples/c++/ecs1030.cxx61
-rw-r--r--peripheral/libupm/examples/c++/enc03r.cxx79
-rw-r--r--peripheral/libupm/examples/c++/es08a.cxx61
-rw-r--r--peripheral/libupm/examples/c++/flex.cxx66
-rw-r--r--peripheral/libupm/examples/c++/gp2y0a.cxx73
-rw-r--r--peripheral/libupm/examples/c++/grovebutton.cxx49
-rw-r--r--peripheral/libupm/examples/c++/grovecircularled.cxx64
-rw-r--r--peripheral/libupm/examples/c++/grovecollision.cxx69
-rw-r--r--peripheral/libupm/examples/c++/groveehr.cxx78
-rw-r--r--peripheral/libupm/examples/c++/groveeldriver.cxx66
-rw-r--r--peripheral/libupm/examples/c++/groveelectromagnet.cxx79
-rw-r--r--peripheral/libupm/examples/c++/groveemg.cxx60
-rw-r--r--peripheral/libupm/examples/c++/grovegprs.cxx111
-rw-r--r--peripheral/libupm/examples/c++/grovegsr.cxx63
-rw-r--r--peripheral/libupm/examples/c++/groveled-multi.cxx68
-rw-r--r--peripheral/libupm/examples/c++/groveled.cxx55
-rw-r--r--peripheral/libupm/examples/c++/groveledbar.cxx77
-rw-r--r--peripheral/libupm/examples/c++/grovelight.cxx49
-rw-r--r--peripheral/libupm/examples/c++/grovelinefinder.cxx66
-rw-r--r--peripheral/libupm/examples/c++/grovemd-stepper.cxx66
-rw-r--r--peripheral/libupm/examples/c++/grovemd.cxx60
-rw-r--r--peripheral/libupm/examples/c++/grovemoisture.cxx75
-rw-r--r--peripheral/libupm/examples/c++/groveo2.cxx57
-rw-r--r--peripheral/libupm/examples/c++/groverelay.cxx58
-rw-r--r--peripheral/libupm/examples/c++/groverotary.cxx57
-rw-r--r--peripheral/libupm/examples/c++/grovescam.cxx77
-rw-r--r--peripheral/libupm/examples/c++/groveslide.cxx50
-rw-r--r--peripheral/libupm/examples/c++/grovespeaker.cxx49
-rw-r--r--peripheral/libupm/examples/c++/grovetemp.cxx55
-rw-r--r--peripheral/libupm/examples/c++/groveultrasonic.cxx62
-rw-r--r--peripheral/libupm/examples/c++/grovevdiv.cxx67
-rw-r--r--peripheral/libupm/examples/c++/grovewater.cxx65
-rw-r--r--peripheral/libupm/examples/c++/grovewfs.cxx78
-rw-r--r--peripheral/libupm/examples/c++/guvas12d.cxx72
-rw-r--r--peripheral/libupm/examples/c++/h3lis331dl.cxx80
-rw-r--r--peripheral/libupm/examples/c++/hcsr04.cxx64
-rw-r--r--peripheral/libupm/examples/c++/hdxxvxta.cxx79
-rw-r--r--peripheral/libupm/examples/c++/hm11.cxx123
-rw-r--r--peripheral/libupm/examples/c++/hmc5883l.cxx50
-rw-r--r--peripheral/libupm/examples/c++/hmtrp.cxx166
-rw-r--r--peripheral/libupm/examples/c++/hp20x.cxx70
-rw-r--r--peripheral/libupm/examples/c++/ht9170.cxx72
-rw-r--r--peripheral/libupm/examples/c++/htu21d.cxx79
-rw-r--r--peripheral/libupm/examples/c++/hwxpxx.cxx102
-rw-r--r--peripheral/libupm/examples/c++/hx711.cxx43
-rw-r--r--peripheral/libupm/examples/c++/ili9341.cxx84
-rw-r--r--peripheral/libupm/examples/c++/ina132.cxx61
-rw-r--r--peripheral/libupm/examples/c++/isd1820.cxx80
-rw-r--r--peripheral/libupm/examples/c++/itg3200.cxx51
-rw-r--r--peripheral/libupm/examples/c++/jhd1313m1-lcd.cxx43
-rw-r--r--peripheral/libupm/examples/c++/joystick12.cxx66
-rw-r--r--peripheral/libupm/examples/c++/kxcjk1013.cxx75
-rw-r--r--peripheral/libupm/examples/c++/l298-stepper.cxx61
-rw-r--r--peripheral/libupm/examples/c++/l298.cxx61
-rw-r--r--peripheral/libupm/examples/c++/lcm1602-i2c.cxx48
-rw-r--r--peripheral/libupm/examples/c++/lcm1602-parallel.cxx54
-rw-r--r--peripheral/libupm/examples/c++/ldt0028.cxx90
-rw-r--r--peripheral/libupm/examples/c++/lm35.cxx65
-rw-r--r--peripheral/libupm/examples/c++/lol.cxx67
-rw-r--r--peripheral/libupm/examples/c++/loudness.cxx68
-rw-r--r--peripheral/libupm/examples/c++/lpd8806.cxx104
-rw-r--r--peripheral/libupm/examples/c++/lsm303.cxx71
-rw-r--r--peripheral/libupm/examples/c++/lsm9ds0.cxx83
-rw-r--r--peripheral/libupm/examples/c++/m24lr64e.cxx65
-rw-r--r--peripheral/libupm/examples/c++/max31723.cxx61
-rw-r--r--peripheral/libupm/examples/c++/max31855.cxx41
-rw-r--r--peripheral/libupm/examples/c++/max44000.cxx42
-rw-r--r--peripheral/libupm/examples/c++/max5487.cxx66
-rw-r--r--peripheral/libupm/examples/c++/maxds3231m.cxx75
-rw-r--r--peripheral/libupm/examples/c++/maxsonarez.cxx72
-rw-r--r--peripheral/libupm/examples/c++/mcp9808.cxx163
-rw-r--r--peripheral/libupm/examples/c++/mg811.cxx68
-rw-r--r--peripheral/libupm/examples/c++/mhz16.cxx84
-rw-r--r--peripheral/libupm/examples/c++/mic.cxx79
-rw-r--r--peripheral/libupm/examples/c++/micsv89.cxx78
-rw-r--r--peripheral/libupm/examples/c++/mlx90614.cxx60
-rw-r--r--peripheral/libupm/examples/c++/mma7455.cxx64
-rw-r--r--peripheral/libupm/examples/c++/mma7660.cxx86
-rw-r--r--peripheral/libupm/examples/c++/mpl3115a2.cxx83
-rw-r--r--peripheral/libupm/examples/c++/mpr121.cxx88
-rw-r--r--peripheral/libupm/examples/c++/mpu60x0.cxx77
-rw-r--r--peripheral/libupm/examples/c++/mpu9150.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mpu9250.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mq2.cxx79
-rw-r--r--peripheral/libupm/examples/c++/mq3.cxx79
-rw-r--r--peripheral/libupm/examples/c++/mq303a.cxx78
-rw-r--r--peripheral/libupm/examples/c++/mq4.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mq5.cxx74
-rw-r--r--peripheral/libupm/examples/c++/mq6.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mq7.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mq8.cxx81
-rw-r--r--peripheral/libupm/examples/c++/mq9.cxx74
-rw-r--r--peripheral/libupm/examples/c++/nlgpio16.cxx52
-rw-r--r--peripheral/libupm/examples/c++/nrf24l01-broadcast.cxx86
-rw-r--r--peripheral/libupm/examples/c++/nrf24l01-receiver.cxx76
-rw-r--r--peripheral/libupm/examples/c++/nrf24l01-transmitter.cxx78
-rw-r--r--peripheral/libupm/examples/c++/nrf8001-broadcast.cxx177
-rw-r--r--peripheral/libupm/examples/c++/nrf8001-broadcast.h93
-rw-r--r--peripheral/libupm/examples/c++/nrf8001-helloworld.cxx362
-rw-r--r--peripheral/libupm/examples/c++/nrf8001-helloworld.h254
-rw-r--r--peripheral/libupm/examples/c++/nunchuck.cxx79
-rw-r--r--peripheral/libupm/examples/c++/otp538u.cxx71
-rw-r--r--peripheral/libupm/examples/c++/ozw.cxx141
-rw-r--r--peripheral/libupm/examples/c++/pca9685.cxx78
-rw-r--r--peripheral/libupm/examples/c++/pn532-writeurl.cxx115
-rw-r--r--peripheral/libupm/examples/c++/pn532.cxx101
-rw-r--r--peripheral/libupm/examples/c++/ppd42ns.cxx63
-rw-r--r--peripheral/libupm/examples/c++/pulsensor.cxx62
-rw-r--r--peripheral/libupm/examples/c++/rfr359f.cxx67
-rw-r--r--peripheral/libupm/examples/c++/rgbringcoder.cxx110
-rw-r--r--peripheral/libupm/examples/c++/rhusb.cxx88
-rw-r--r--peripheral/libupm/examples/c++/rotaryencoder.cxx61
-rw-r--r--peripheral/libupm/examples/c++/rpr220-intr.cxx78
-rw-r--r--peripheral/libupm/examples/c++/rpr220.cxx68
-rw-r--r--peripheral/libupm/examples/c++/sainsmartks.cxx66
-rw-r--r--peripheral/libupm/examples/c++/si114x.cxx78
-rw-r--r--peripheral/libupm/examples/c++/sm130.cxx74
-rw-r--r--peripheral/libupm/examples/c++/ssd1306-oled.cxx149
-rw-r--r--peripheral/libupm/examples/c++/ssd1308-oled.cxx99
-rw-r--r--peripheral/libupm/examples/c++/ssd1327-oled.cxx127
-rw-r--r--peripheral/libupm/examples/c++/ssd1351.cxx61
-rw-r--r--peripheral/libupm/examples/c++/st7735.cxx79
-rw-r--r--peripheral/libupm/examples/c++/stepmotor.cxx78
-rw-r--r--peripheral/libupm/examples/c++/sx1276-fsk.cxx121
-rw-r--r--peripheral/libupm/examples/c++/sx1276-lora.cxx119
-rw-r--r--peripheral/libupm/examples/c++/sx6119.cxx69
-rw-r--r--peripheral/libupm/examples/c++/t3311.cxx115
-rw-r--r--peripheral/libupm/examples/c++/ta12200.cxx65
-rw-r--r--peripheral/libupm/examples/c++/tcs3414cs.cxx65
-rw-r--r--peripheral/libupm/examples/c++/th02.cxx64
-rw-r--r--peripheral/libupm/examples/c++/tm1637.cxx79
-rw-r--r--peripheral/libupm/examples/c++/tp401.cxx70
-rw-r--r--peripheral/libupm/examples/c++/tsl2561.cxx54
-rw-r--r--peripheral/libupm/examples/c++/ttp223.cxx54
-rw-r--r--peripheral/libupm/examples/c++/ublox6.cxx97
-rw-r--r--peripheral/libupm/examples/c++/uln200xa.cxx62
-rw-r--r--peripheral/libupm/examples/c++/urm37-uart.cxx66
-rw-r--r--peripheral/libupm/examples/c++/urm37.cxx65
-rw-r--r--peripheral/libupm/examples/c++/waterlevel.cxx62
-rw-r--r--peripheral/libupm/examples/c++/wheelencoder.cxx69
-rw-r--r--peripheral/libupm/examples/c++/wt5001.cxx130
-rw-r--r--peripheral/libupm/examples/c++/xbee.cxx145
-rw-r--r--peripheral/libupm/examples/c++/yg1006.cxx66
-rw-r--r--peripheral/libupm/examples/c++/zfm20-register.cxx140
-rw-r--r--peripheral/libupm/examples/c++/zfm20.cxx112
-rw-r--r--peripheral/libupm/examples/java/A110XSample.java43
-rw-r--r--peripheral/libupm/examples/java/A110X_intrSample.java57
-rw-r--r--peripheral/libupm/examples/java/ADC121C021Sample.java46
-rw-r--r--peripheral/libupm/examples/java/Ad8232Example.java62
-rw-r--r--peripheral/libupm/examples/java/Adxl345Sample.java51
-rw-r--r--peripheral/libupm/examples/java/Apds9002.java47
-rw-r--r--peripheral/libupm/examples/java/BISS0001Sample.java45
-rw-r--r--peripheral/libupm/examples/java/BMPX8XSample.java48
-rw-r--r--peripheral/libupm/examples/java/BuzzerSample.java55
-rw-r--r--peripheral/libupm/examples/java/Buzzer_soundSample.java57
-rw-r--r--peripheral/libupm/examples/java/CJQ4435Sample.java52
-rw-r--r--peripheral/libupm/examples/java/CMakeLists.txt116
-rw-r--r--peripheral/libupm/examples/java/DS1307Sample.java74
-rw-r--r--peripheral/libupm/examples/java/ENC03RSample.java55
-rw-r--r--peripheral/libupm/examples/java/ES08ASample.java53
-rw-r--r--peripheral/libupm/examples/java/FlexSensorExample.java41
-rw-r--r--peripheral/libupm/examples/java/GROVESCAMSample.java66
-rw-r--r--peripheral/libupm/examples/java/GUVAS12DSample.java46
-rw-r--r--peripheral/libupm/examples/java/Gp2y0aExample.java68
-rw-r--r--peripheral/libupm/examples/java/GroveButtonSample.java40
-rw-r--r--peripheral/libupm/examples/java/GroveButton_intrSample.java53
-rw-r--r--peripheral/libupm/examples/java/GroveCollision.java48
-rw-r--r--peripheral/libupm/examples/java/GroveEHRSample.java53
-rw-r--r--peripheral/libupm/examples/java/GroveEmg.java47
-rw-r--r--peripheral/libupm/examples/java/GroveGsr.java50
-rw-r--r--peripheral/libupm/examples/java/GroveLEDBar.java41
-rw-r--r--peripheral/libupm/examples/java/GroveLEDSample.java39
-rw-r--r--peripheral/libupm/examples/java/GroveLed_multiSample.java45
-rw-r--r--peripheral/libupm/examples/java/GroveLightSample.java41
-rw-r--r--peripheral/libupm/examples/java/GroveLineFinderSample.java45
-rw-r--r--peripheral/libupm/examples/java/GroveMDSample.java53
-rw-r--r--peripheral/libupm/examples/java/GroveMQ3.java70
-rw-r--r--peripheral/libupm/examples/java/GroveMQ9.java70
-rw-r--r--peripheral/libupm/examples/java/GroveMoistureSample.java47
-rw-r--r--peripheral/libupm/examples/java/GroveO2Example.java46
-rw-r--r--peripheral/libupm/examples/java/GroveQTouch.java69
-rw-r--r--peripheral/libupm/examples/java/GroveRelaySample.java44
-rw-r--r--peripheral/libupm/examples/java/GroveRotarySample.java49
-rw-r--r--peripheral/libupm/examples/java/GroveSlideSample.java42
-rw-r--r--peripheral/libupm/examples/java/GroveSpeakerSample.java40
-rw-r--r--peripheral/libupm/examples/java/GroveTempSample.java43
-rw-r--r--peripheral/libupm/examples/java/GroveVDivSample.java50
-rw-r--r--peripheral/libupm/examples/java/GroveWFSSample.java44
-rw-r--r--peripheral/libupm/examples/java/GroveWaterSample.java45
-rw-r--r--peripheral/libupm/examples/java/H3LIS331DLSample.java52
-rw-r--r--peripheral/libupm/examples/java/HCSR04Sample.java43
-rw-r--r--peripheral/libupm/examples/java/HM11Sample.java96
-rw-r--r--peripheral/libupm/examples/java/HMTRPSample.java122
-rw-r--r--peripheral/libupm/examples/java/HP20xExample.java50
-rw-r--r--peripheral/libupm/examples/java/HTU21DSample.java50
-rw-r--r--peripheral/libupm/examples/java/Hmc5883lSample.java50
-rw-r--r--peripheral/libupm/examples/java/Itg3200Sample.java51
-rw-r--r--peripheral/libupm/examples/java/Jhd1313m1Sample.java42
-rw-r--r--peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java42
-rw-r--r--peripheral/libupm/examples/java/Joystick12Sample.java44
-rw-r--r--peripheral/libupm/examples/java/Joystick12_exampleSample.java44
-rw-r--r--peripheral/libupm/examples/java/LDT0028Sample.java42
-rw-r--r--peripheral/libupm/examples/java/LSM303Sample.java59
-rw-r--r--peripheral/libupm/examples/java/Lcm1602_i2cSample.java49
-rw-r--r--peripheral/libupm/examples/java/Lcm1602_parallelSample.java52
-rw-r--r--peripheral/libupm/examples/java/LoLSample.java47
-rw-r--r--peripheral/libupm/examples/java/LoL_exampleSample.java47
-rw-r--r--peripheral/libupm/examples/java/M24LR64ESample.java55
-rw-r--r--peripheral/libupm/examples/java/MAX44000Sample.java38
-rw-r--r--peripheral/libupm/examples/java/MHZ16Sample.java50
-rw-r--r--peripheral/libupm/examples/java/MMA7455Sample.java42
-rw-r--r--peripheral/libupm/examples/java/MMA7660Sample.java55
-rw-r--r--peripheral/libupm/examples/java/MPL3115A2Sample.java45
-rw-r--r--peripheral/libupm/examples/java/MPR121Sample.java34
-rw-r--r--peripheral/libupm/examples/java/MPU9150Sample.java53
-rw-r--r--peripheral/libupm/examples/java/MQ2Sample.java56
-rw-r--r--peripheral/libupm/examples/java/MQ303ASample.java53
-rw-r--r--peripheral/libupm/examples/java/MQ5Sample.java55
-rw-r--r--peripheral/libupm/examples/java/MicrophoneSample.java56
-rw-r--r--peripheral/libupm/examples/java/NRF24L01_receiverSample.java75
-rw-r--r--peripheral/libupm/examples/java/NRF24L01_transmitterSample.java66
-rw-r--r--peripheral/libupm/examples/java/NUNCHUCKSample.java61
-rw-r--r--peripheral/libupm/examples/java/OTP538USample.java43
-rw-r--r--peripheral/libupm/examples/java/PPD42NSSample.java45
-rw-r--r--peripheral/libupm/examples/java/PulsensorSample.java46
-rw-r--r--peripheral/libupm/examples/java/RFR359FSample.java44
-rw-r--r--peripheral/libupm/examples/java/RPR220Sample.java44
-rw-r--r--peripheral/libupm/examples/java/RPR220_intrSample.java54
-rw-r--r--peripheral/libupm/examples/java/RotaryEncoderSample.java40
-rw-r--r--peripheral/libupm/examples/java/SSD1308_oledSample.java89
-rw-r--r--peripheral/libupm/examples/java/SSD1327_oledSample.java135
-rw-r--r--peripheral/libupm/examples/java/ST7735Sample.java77
-rw-r--r--peripheral/libupm/examples/java/StepMotorSample.java56
-rw-r--r--peripheral/libupm/examples/java/TM1637Sample.java58
-rw-r--r--peripheral/libupm/examples/java/TP401Sample.java66
-rw-r--r--peripheral/libupm/examples/java/TSL2561Sample.java40
-rw-r--r--peripheral/libupm/examples/java/TTP223Sample.java42
-rw-r--r--peripheral/libupm/examples/java/Th02Example.java59
-rw-r--r--peripheral/libupm/examples/java/ULN200XASample.java54
-rw-r--r--peripheral/libupm/examples/java/Ublox6Sample.java73
-rw-r--r--peripheral/libupm/examples/java/WT5001Sample.java130
-rw-r--r--peripheral/libupm/examples/java/WaterLevelSensor.java52
-rw-r--r--peripheral/libupm/examples/java/YG1006Sample.java45
-rw-r--r--peripheral/libupm/examples/java/ZFM20Sample.java88
-rw-r--r--peripheral/libupm/examples/javascript/a110x.js47
-rw-r--r--peripheral/libupm/examples/javascript/ad8232.js51
-rw-r--r--peripheral/libupm/examples/javascript/adafruitms1438-stepper.js92
-rw-r--r--peripheral/libupm/examples/javascript/adafruitms1438.js89
-rw-r--r--peripheral/libupm/examples/javascript/adc121c021.js53
-rw-r--r--peripheral/libupm/examples/javascript/adis16448.js67
-rw-r--r--peripheral/libupm/examples/javascript/ads1x15.js46
-rw-r--r--peripheral/libupm/examples/javascript/adxl335.js89
-rw-r--r--peripheral/libupm/examples/javascript/adxl345.js41
-rw-r--r--peripheral/libupm/examples/javascript/adxrs610.js57
-rw-r--r--peripheral/libupm/examples/javascript/ak8975.js64
-rw-r--r--peripheral/libupm/examples/javascript/apds9002.js47
-rw-r--r--peripheral/libupm/examples/javascript/at42qt1070.js81
-rw-r--r--peripheral/libupm/examples/javascript/biss0001.js45
-rw-r--r--peripheral/libupm/examples/javascript/bma220.js59
-rw-r--r--peripheral/libupm/examples/javascript/bmpx8x.js55
-rw-r--r--peripheral/libupm/examples/javascript/buzzer.js65
-rw-r--r--peripheral/libupm/examples/javascript/cjq4435.js87
-rw-r--r--peripheral/libupm/examples/javascript/dfrph.js59
-rw-r--r--peripheral/libupm/examples/javascript/ds1307.js68
-rw-r--r--peripheral/libupm/examples/javascript/eboled.js150
-rw-r--r--peripheral/libupm/examples/javascript/enc03r.js66
-rw-r--r--peripheral/libupm/examples/javascript/es08a.js69
-rw-r--r--peripheral/libupm/examples/javascript/flex.js53
-rw-r--r--peripheral/libupm/examples/javascript/gp2y0a.js60
-rw-r--r--peripheral/libupm/examples/javascript/grove_mcfled.js46
-rw-r--r--peripheral/libupm/examples/javascript/grovebutton.js35
-rw-r--r--peripheral/libupm/examples/javascript/grovecircularled.js49
-rw-r--r--peripheral/libupm/examples/javascript/grovecollision.js62
-rw-r--r--peripheral/libupm/examples/javascript/groveehr.js64
-rw-r--r--peripheral/libupm/examples/javascript/groveeldriver.js54
-rw-r--r--peripheral/libupm/examples/javascript/groveelectromagnet.js57
-rw-r--r--peripheral/libupm/examples/javascript/groveemg.js48
-rw-r--r--peripheral/libupm/examples/javascript/grovegprs.js114
-rw-r--r--peripheral/libupm/examples/javascript/grovegsr.js51
-rw-r--r--peripheral/libupm/examples/javascript/groveled.js46
-rw-r--r--peripheral/libupm/examples/javascript/groveledbar.js73
-rw-r--r--peripheral/libupm/examples/javascript/grovelight.js37
-rw-r--r--peripheral/libupm/examples/javascript/grovelinefinder.js47
-rw-r--r--peripheral/libupm/examples/javascript/grovemd-stepper.js95
-rw-r--r--peripheral/libupm/examples/javascript/grovemd.js94
-rw-r--r--peripheral/libupm/examples/javascript/grovemoisture.js57
-rw-r--r--peripheral/libupm/examples/javascript/groveo2.js52
-rw-r--r--peripheral/libupm/examples/javascript/groverelay.js49
-rw-r--r--peripheral/libupm/examples/javascript/groverotary.js49
-rw-r--r--peripheral/libupm/examples/javascript/grovescam.js72
-rw-r--r--peripheral/libupm/examples/javascript/groveslide.js42
-rw-r--r--peripheral/libupm/examples/javascript/grovespeaker.js44
-rw-r--r--peripheral/libupm/examples/javascript/grovetemp.js42
-rw-r--r--peripheral/libupm/examples/javascript/groveultrasonic.js45
-rw-r--r--peripheral/libupm/examples/javascript/grovevdiv.js53
-rw-r--r--peripheral/libupm/examples/javascript/grovewater.js49
-rw-r--r--peripheral/libupm/examples/javascript/grovewfs.js69
-rw-r--r--peripheral/libupm/examples/javascript/guvas12d.js56
-rw-r--r--peripheral/libupm/examples/javascript/h3lis331dl.js91
-rw-r--r--peripheral/libupm/examples/javascript/hdxxvxta.js64
-rw-r--r--peripheral/libupm/examples/javascript/hm11.js136
-rw-r--r--peripheral/libupm/examples/javascript/hmc5883l.js61
-rw-r--r--peripheral/libupm/examples/javascript/hmtrp.js161
-rw-r--r--peripheral/libupm/examples/javascript/hp20x.js55
-rw-r--r--peripheral/libupm/examples/javascript/ht9170.js54
-rw-r--r--peripheral/libupm/examples/javascript/hwxpxx.js86
-rw-r--r--peripheral/libupm/examples/javascript/hx711.js36
-rw-r--r--peripheral/libupm/examples/javascript/ili9341.js79
-rw-r--r--peripheral/libupm/examples/javascript/ina132.js54
-rw-r--r--peripheral/libupm/examples/javascript/isd1820.js68
-rw-r--r--peripheral/libupm/examples/javascript/itg3200.js64
-rw-r--r--peripheral/libupm/examples/javascript/jhd1313m1-lcd.js41
-rw-r--r--peripheral/libupm/examples/javascript/joystick12.js54
-rw-r--r--peripheral/libupm/examples/javascript/l298-stepper.js77
-rw-r--r--peripheral/libupm/examples/javascript/l298.js77
-rw-r--r--peripheral/libupm/examples/javascript/ldt0028.js82
-rw-r--r--peripheral/libupm/examples/javascript/lm35.js51
-rw-r--r--peripheral/libupm/examples/javascript/loudness.js52
-rw-r--r--peripheral/libupm/examples/javascript/lsm303.js78
-rw-r--r--peripheral/libupm/examples/javascript/lsm9ds0.js77
-rw-r--r--peripheral/libupm/examples/javascript/m24lr64e.js59
-rw-r--r--peripheral/libupm/examples/javascript/maxsonarez.js59
-rw-r--r--peripheral/libupm/examples/javascript/mcp9808.js70
-rw-r--r--peripheral/libupm/examples/javascript/mg811.js53
-rw-r--r--peripheral/libupm/examples/javascript/mhz16.js78
-rw-r--r--peripheral/libupm/examples/javascript/mic.js61
-rw-r--r--peripheral/libupm/examples/javascript/micsv89.js26
-rw-r--r--peripheral/libupm/examples/javascript/mma7660.js98
-rw-r--r--peripheral/libupm/examples/javascript/mpr121.js69
-rw-r--r--peripheral/libupm/examples/javascript/mpu60x0.js71
-rw-r--r--peripheral/libupm/examples/javascript/mpu9150.js76
-rw-r--r--peripheral/libupm/examples/javascript/mpu9250.js76
-rw-r--r--peripheral/libupm/examples/javascript/mq2.js59
-rw-r--r--peripheral/libupm/examples/javascript/mq3.js60
-rw-r--r--peripheral/libupm/examples/javascript/mq303a.js78
-rw-r--r--peripheral/libupm/examples/javascript/mq4.js60
-rw-r--r--peripheral/libupm/examples/javascript/mq5.js57
-rw-r--r--peripheral/libupm/examples/javascript/mq6.js60
-rw-r--r--peripheral/libupm/examples/javascript/mq7.js60
-rw-r--r--peripheral/libupm/examples/javascript/mq8.js60
-rw-r--r--peripheral/libupm/examples/javascript/mq9.js56
-rw-r--r--peripheral/libupm/examples/javascript/nlgpio16.js51
-rw-r--r--peripheral/libupm/examples/javascript/nunchuck.js66
-rw-r--r--peripheral/libupm/examples/javascript/oled_ssd1306.js151
-rw-r--r--peripheral/libupm/examples/javascript/oled_ssd1308.js99
-rw-r--r--peripheral/libupm/examples/javascript/oled_ssd1327.js194
-rw-r--r--peripheral/libupm/examples/javascript/otp538u.js64
-rw-r--r--peripheral/libupm/examples/javascript/ozw.js128
-rw-r--r--peripheral/libupm/examples/javascript/pca9685.js85
-rw-r--r--peripheral/libupm/examples/javascript/pn532-writeurl.js136
-rw-r--r--peripheral/libupm/examples/javascript/pn532.js102
-rw-r--r--peripheral/libupm/examples/javascript/ppd42ns.js52
-rw-r--r--peripheral/libupm/examples/javascript/rfr359f.js48
-rw-r--r--peripheral/libupm/examples/javascript/rgbringcoder.js98
-rw-r--r--peripheral/libupm/examples/javascript/rhusb.js76
-rw-r--r--peripheral/libupm/examples/javascript/rotaryencoder.js43
-rw-r--r--peripheral/libupm/examples/javascript/rpr220.js49
-rw-r--r--peripheral/libupm/examples/javascript/sainsmartks.js53
-rw-r--r--peripheral/libupm/examples/javascript/si114x.js66
-rw-r--r--peripheral/libupm/examples/javascript/sm130.js70
-rw-r--r--peripheral/libupm/examples/javascript/st7735.js65
-rw-r--r--peripheral/libupm/examples/javascript/stepmotor.js68
-rw-r--r--peripheral/libupm/examples/javascript/sx1276-fsk.js112
-rw-r--r--peripheral/libupm/examples/javascript/sx1276-lora.js110
-rw-r--r--peripheral/libupm/examples/javascript/sx6119.js53
-rw-r--r--peripheral/libupm/examples/javascript/t3311.js101
-rw-r--r--peripheral/libupm/examples/javascript/ta12200.js51
-rw-r--r--peripheral/libupm/examples/javascript/tcs3414cs.js47
-rw-r--r--peripheral/libupm/examples/javascript/tm1637.js66
-rw-r--r--peripheral/libupm/examples/javascript/tp401.js68
-rw-r--r--peripheral/libupm/examples/javascript/tsl2561.js44
-rw-r--r--peripheral/libupm/examples/javascript/ttp223.js40
-rw-r--r--peripheral/libupm/examples/javascript/ublox6.js84
-rw-r--r--peripheral/libupm/examples/javascript/uln200xa.js71
-rw-r--r--peripheral/libupm/examples/javascript/urm37-uart.js52
-rw-r--r--peripheral/libupm/examples/javascript/urm37.js52
-rw-r--r--peripheral/libupm/examples/javascript/waterlevel.js50
-rw-r--r--peripheral/libupm/examples/javascript/wheelencoder.js54
-rw-r--r--peripheral/libupm/examples/javascript/wt5001.js130
-rw-r--r--peripheral/libupm/examples/javascript/xbee.js140
-rw-r--r--peripheral/libupm/examples/javascript/yg1006.js47
-rw-r--r--peripheral/libupm/examples/javascript/zfm20-register.js137
-rw-r--r--peripheral/libupm/examples/javascript/zfm20.js97
-rw-r--r--peripheral/libupm/examples/python/a110x.py51
-rw-r--r--peripheral/libupm/examples/python/ad8232.py54
-rw-r--r--peripheral/libupm/examples/python/adafruitms1438-stepper.py88
-rw-r--r--peripheral/libupm/examples/python/adafruitms1438.py83
-rw-r--r--peripheral/libupm/examples/python/adc121c021.py55
-rw-r--r--peripheral/libupm/examples/python/adxl335.py78
-rw-r--r--peripheral/libupm/examples/python/adxl345.py41
-rw-r--r--peripheral/libupm/examples/python/adxrs610.py55
-rw-r--r--peripheral/libupm/examples/python/ak8975.py59
-rw-r--r--peripheral/libupm/examples/python/apds9002.py50
-rw-r--r--peripheral/libupm/examples/python/at42qt1070.py79
-rw-r--r--peripheral/libupm/examples/python/biss0001.py52
-rw-r--r--peripheral/libupm/examples/python/bma220.py55
-rw-r--r--peripheral/libupm/examples/python/bmpx8x.py59
-rw-r--r--peripheral/libupm/examples/python/buzzer.py45
-rw-r--r--peripheral/libupm/examples/python/cjq4435.py46
-rw-r--r--peripheral/libupm/examples/python/dfrph.py56
-rw-r--r--peripheral/libupm/examples/python/ds1307.py60
-rw-r--r--peripheral/libupm/examples/python/eboled.py41
-rw-r--r--peripheral/libupm/examples/python/enc03r.py64
-rw-r--r--peripheral/libupm/examples/python/es08a.py46
-rw-r--r--peripheral/libupm/examples/python/gp2y0a.py62
-rw-r--r--peripheral/libupm/examples/python/grovebutton.py35
-rw-r--r--peripheral/libupm/examples/python/grovecircularled.py50
-rw-r--r--peripheral/libupm/examples/python/grovecollision.py57
-rw-r--r--peripheral/libupm/examples/python/groveehr.py68
-rw-r--r--peripheral/libupm/examples/python/groveeldriver.py57
-rw-r--r--peripheral/libupm/examples/python/groveelectromagnet.py60
-rw-r--r--peripheral/libupm/examples/python/groveemg.py52
-rw-r--r--peripheral/libupm/examples/python/grovegprs.py86
-rw-r--r--peripheral/libupm/examples/python/grovegsr.py53
-rw-r--r--peripheral/libupm/examples/python/groveled.py41
-rw-r--r--peripheral/libupm/examples/python/groveledbar.py64
-rw-r--r--peripheral/libupm/examples/python/grovelight.py37
-rw-r--r--peripheral/libupm/examples/python/grovelinefinder.py51
-rw-r--r--peripheral/libupm/examples/python/grovemd-stepper.py52
-rw-r--r--peripheral/libupm/examples/python/grovemd.py47
-rw-r--r--peripheral/libupm/examples/python/grovemoisture.py61
-rw-r--r--peripheral/libupm/examples/python/groveo2.py51
-rw-r--r--peripheral/libupm/examples/python/groverelay.py44
-rw-r--r--peripheral/libupm/examples/python/groverotary.py45
-rw-r--r--peripheral/libupm/examples/python/grovescam.py61
-rw-r--r--peripheral/libupm/examples/python/groveslide.py39
-rw-r--r--peripheral/libupm/examples/python/grovespeaker.py34
-rw-r--r--peripheral/libupm/examples/python/grovetemp.py41
-rw-r--r--peripheral/libupm/examples/python/grovevdiv.py54
-rw-r--r--peripheral/libupm/examples/python/grovewater.py51
-rw-r--r--peripheral/libupm/examples/python/grovewfs.py64
-rw-r--r--peripheral/libupm/examples/python/guvas12d.py56
-rw-r--r--peripheral/libupm/examples/python/h3lis331dl.py76
-rw-r--r--peripheral/libupm/examples/python/hdxxvxta.py59
-rw-r--r--peripheral/libupm/examples/python/hm11.py110
-rw-r--r--peripheral/libupm/examples/python/hmc5883l.py44
-rw-r--r--peripheral/libupm/examples/python/hmtrp.py143
-rw-r--r--peripheral/libupm/examples/python/hp20x.py54
-rw-r--r--peripheral/libupm/examples/python/ht9170.py54
-rw-r--r--peripheral/libupm/examples/python/hwxpxx.py79
-rw-r--r--peripheral/libupm/examples/python/ili9341.py75
-rw-r--r--peripheral/libupm/examples/python/ina132.py51
-rw-r--r--peripheral/libupm/examples/python/isd1820.py74
-rw-r--r--peripheral/libupm/examples/python/itg3200.py42
-rw-r--r--peripheral/libupm/examples/python/jhd1313m1-lcd.py38
-rw-r--r--peripheral/libupm/examples/python/joystick12.py52
-rw-r--r--peripheral/libupm/examples/python/l298-stepper.py67
-rw-r--r--peripheral/libupm/examples/python/l298.py65
-rw-r--r--peripheral/libupm/examples/python/ldt0028.py66
-rw-r--r--peripheral/libupm/examples/python/lm35.py49
-rw-r--r--peripheral/libupm/examples/python/loudness.py50
-rw-r--r--peripheral/libupm/examples/python/lsm303.py87
-rw-r--r--peripheral/libupm/examples/python/lsm9ds0.py71
-rw-r--r--peripheral/libupm/examples/python/m24lr64e.py49
-rwxr-xr-xperipheral/libupm/examples/python/make_oled_pic.py74
-rw-r--r--peripheral/libupm/examples/python/maxsonarez.py60
-rw-r--r--peripheral/libupm/examples/python/mg811.py51
-rw-r--r--peripheral/libupm/examples/python/mhz16.py70
-rw-r--r--peripheral/libupm/examples/python/mic.py47
-rw-r--r--peripheral/libupm/examples/python/mma7660.py81
-rw-r--r--peripheral/libupm/examples/python/mpr121.py73
-rw-r--r--peripheral/libupm/examples/python/mpu60x0.py65
-rw-r--r--peripheral/libupm/examples/python/mpu9150.py70
-rw-r--r--peripheral/libupm/examples/python/mpu9250.py70
-rw-r--r--peripheral/libupm/examples/python/mq2.py62
-rw-r--r--peripheral/libupm/examples/python/mq3.py62
-rw-r--r--peripheral/libupm/examples/python/mq303a.py75
-rw-r--r--peripheral/libupm/examples/python/mq4.py62
-rw-r--r--peripheral/libupm/examples/python/mq5.py62
-rw-r--r--peripheral/libupm/examples/python/mq6.py62
-rw-r--r--peripheral/libupm/examples/python/mq7.py62
-rw-r--r--peripheral/libupm/examples/python/mq8.py62
-rw-r--r--peripheral/libupm/examples/python/mq9.py62
-rw-r--r--peripheral/libupm/examples/python/nlgpio16.py51
-rw-r--r--peripheral/libupm/examples/python/nunchuck.py73
-rw-r--r--peripheral/libupm/examples/python/oled_ssd1308.py95
-rw-r--r--peripheral/libupm/examples/python/oled_ssd1327.py189
-rw-r--r--peripheral/libupm/examples/python/otp538u.py58
-rw-r--r--peripheral/libupm/examples/python/ozw.py126
-rw-r--r--peripheral/libupm/examples/python/pn532-writeurl.py105
-rw-r--r--peripheral/libupm/examples/python/pn532.py85
-rw-r--r--peripheral/libupm/examples/python/ppd42ns.py56
-rw-r--r--peripheral/libupm/examples/python/rfr359f.py52
-rw-r--r--peripheral/libupm/examples/python/rgbringcoder.py90
-rw-r--r--peripheral/libupm/examples/python/rhusb.py69
-rw-r--r--peripheral/libupm/examples/python/rotaryencoder.py49
-rw-r--r--peripheral/libupm/examples/python/rpr220.py56
-rw-r--r--peripheral/libupm/examples/python/sainsmartks.py54
-rw-r--r--peripheral/libupm/examples/python/si114x.py66
-rw-r--r--peripheral/libupm/examples/python/sm130.py63
-rw-r--r--peripheral/libupm/examples/python/stepmotor.py64
-rw-r--r--peripheral/libupm/examples/python/sx1276-fsk.py89
-rw-r--r--peripheral/libupm/examples/python/sx1276-lora.py88
-rw-r--r--peripheral/libupm/examples/python/sx6119.py50
-rw-r--r--peripheral/libupm/examples/python/t3311.py90
-rw-r--r--peripheral/libupm/examples/python/ta12200.py54
-rw-r--r--peripheral/libupm/examples/python/tcs3414cs.py55
-rw-r--r--peripheral/libupm/examples/python/tm1637.py54
-rw-r--r--peripheral/libupm/examples/python/tp401.py54
-rw-r--r--peripheral/libupm/examples/python/tsl2561.py48
-rw-r--r--peripheral/libupm/examples/python/ttp223.py39
-rw-r--r--peripheral/libupm/examples/python/ublox6.py82
-rw-r--r--peripheral/libupm/examples/python/uln200xa.py66
-rw-r--r--peripheral/libupm/examples/python/urm37-uart.py50
-rw-r--r--peripheral/libupm/examples/python/urm37.py50
-rw-r--r--peripheral/libupm/examples/python/using_carrays.py31
-rw-r--r--peripheral/libupm/examples/python/waterlevel.py54
-rw-r--r--peripheral/libupm/examples/python/wheelencoder.py50
-rw-r--r--peripheral/libupm/examples/python/wt5001.py107
-rw-r--r--peripheral/libupm/examples/python/xbee.py117
-rw-r--r--peripheral/libupm/examples/python/yg1006.py52
-rw-r--r--peripheral/libupm/examples/python/zfm20-register.py132
-rw-r--r--peripheral/libupm/examples/python/zfm20.py90
539 files changed, 0 insertions, 37308 deletions
diff --git a/peripheral/libupm/examples/c++/CMakeLists.txt b/peripheral/libupm/examples/c++/CMakeLists.txt
deleted file mode 100644
index b227703..0000000
--- a/peripheral/libupm/examples/c++/CMakeLists.txt
+++ /dev/null
@@ -1,260 +0,0 @@
-# Extract module name from non-standard example name
-macro(get_module_name example_name module_name)
- string(LENGTH ${example_name} length)
- string(FIND ${example_name} "-" index)
- if (${index} GREATER 1)
- string(SUBSTRING ${example_name} 0 ${index} substr)
- set(${module_name} ${substr})
- elseif (${example_name} MATCHES "^grove")
- set (${module_name} "grove")
- elseif ((${example_name} MATCHES "^mq" AND ${length} EQUAL 3) OR ${example_name} STREQUAL "tp401")
- set (${module_name} "gas")
- else()
- set(${module_name} ${example_name})
- endif()
-endmacro()
-
-# Set source file, include and linker settings for an example
-# If example cannot be built, example_bin is cleared
-macro(add_custom_example example_bin example_src example_module_list)
- set(found_all_modules TRUE)
- foreach (module ${example_module_list})
- if (NOT EXISTS "${PROJECT_SOURCE_DIR}/src/${module}")
- set(found_all_modules FALSE)
- endif()
- if (MODULE_LIST)
- list(FIND MODULE_LIST ${module} index)
- if (${index} EQUAL -1)
- set(found_all_modules FALSE)
- endif()
- endif()
- endforeach()
- if (found_all_modules)
- add_executable (${example_bin} ${example_src})
- target_link_libraries (${example_bin} ${CMAKE_THREAD_LIBS_INIT})
- foreach (module ${example_module_list})
- set(module_dir "${PROJECT_SOURCE_DIR}/src/${module}")
- include_directories (${module_dir})
- if (${module} STREQUAL "lcd")
- set(module "i2clcd")
- endif()
- target_link_libraries (${example_bin} ${module})
- endforeach()
- else()
- MESSAGE(INFO " Ignored ${example_bin}")
- set (example_bin "")
- endif()
-endmacro()
-
-
-# Add specified example by name
-# Note special case for grove based examples
-macro(add_example example_name)
- set(example_src "${example_name}.cxx")
- set(example_bin "${example_name}-example")
- get_module_name(${example_name} module_name)
- set(module_dir "${PROJECT_SOURCE_DIR}/src/${module_name}")
- if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${example_src}"
- AND EXISTS ${module_dir}
- AND IS_DIRECTORY ${module_dir})
- add_custom_example(${example_bin} ${example_src} ${module_name})
- if ((NOT ${example_bin} STREQUAL "") AND (${module_name} STREQUAL "grove"))
- set(grove_module_path "${PROJECT_SOURCE_DIR}/src/${example_name}")
- if (EXISTS ${grove_module_path})
- include_directories(${grove_module_path})
- target_link_libraries (${example_bin} ${example_name})
- endif()
- endif()
- else()
- MESSAGE(INFO " Ignored ${example_bin}")
- endif()
-endmacro()
-
-
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples)
-
-# Set the mraa include and link directories prior to adding examples
-include_directories (${MRAA_INCLUDE_DIRS})
-link_directories (${MRAA_LIBDIR})
-
-# If your sample source file matches the name of the module it tests, add it here
-# Exceptions are as follows:
-# string after first '-' is ignored (e.g. nrf24l01-transmitter maps to nrf24l01)
-# mq? will use module gas
-# grove* will use module grove
-add_example (hmc5883l)
-add_example (groveled)
-add_example (groverelay)
-add_example (grovelight)
-add_example (grovetemp)
-add_example (grovebutton)
-add_example (groverotary)
-add_example (groveslide)
-add_example (buzzer-sound)
-add_example (nrf24l01-transmitter)
-add_example (nrf24l01-receiver)
-add_example (nrf24l01-broadcast)
-add_example (hcsr04)
-add_example (max44000)
-add_example (mma7455)
-add_example (st7735)
-add_example (max31855)
-add_example (bmpx8x)
-add_example (stepmotor)
-add_example (pulsensor)
-add_example (mic)
-add_example (mpu9150)
-add_example (maxds3231m)
-add_example (max31723)
-add_example (max5487)
-add_example (nrf8001-broadcast)
-add_example (nrf8001-helloworld)
-add_example (lpd8806)
-add_example (mlx90614)
-add_example (ecs1030)
-add_example (mq2)
-add_example (mq3)
-add_example (mq4)
-add_example (mq5)
-add_example (mq6)
-add_example (mq7)
-add_example (mq8)
-add_example (mq9)
-add_example (tp401)
-add_example (tcs3414cs)
-add_example (th02)
-add_example (ttp223)
-add_example (lsm303)
-add_example (joystick12)
-add_example (lol)
-add_example (tsl2561)
-add_example (htu21d)
-add_example (mpl3115a2)
-add_example (ldt0028)
-add_example (am2315)
-add_example (itg3200)
-add_example (enc03r)
-add_example (adc121c021)
-add_example (ds1307)
-add_example (a110x)
-add_example (gp2y0a)
-add_example (grovemoisture)
-add_example (groveehr)
-add_example (ta12200)
-add_example (grovelinefinder)
-add_example (grovevdiv)
-add_example (grovewater)
-add_example (guvas12d)
-add_example (mpr121)
-add_example (ublox6)
-add_example (yg1006)
-add_example (wt5001)
-add_example (ppd42ns)
-add_example (mq303a)
-add_example (grovespeaker)
-add_example (rfr359f)
-add_example (biss0001)
-add_example (rotaryencoder)
-add_example (adxl345)
-add_example (rpr220)
-add_example (rpr220-intr)
-add_example (mma7660)
-add_example (cjq4435)
-add_example (adxl335)
-add_example (hmtrp)
-add_example (nunchuck)
-add_example (otp538u)
-add_example (grovecollision)
-add_example (groveelectromagnet)
-add_example (groveemg)
-add_example (groveo2)
-add_example (grovegsr)
-add_example (ina132)
-add_example (l298)
-add_example (l298-stepper)
-add_example (at42qt1070)
-add_example (grovemd)
-add_example (grovemd-stepper)
-add_example (pca9685)
-add_example (groveeldriver)
-add_example (adafruitss)
-add_example (adafruitms1438)
-add_example (adafruitms1438-stepper)
-add_example (hx711)
-add_example (flex)
-add_example (a110x-intr)
-add_example (mhz16)
-add_example (apds9002)
-add_example (waterlevel)
-add_example (tm1637)
-add_example (zfm20)
-add_example (zfm20-register)
-add_example (uln200xa)
-add_example (grovewfs)
-add_example (isd1820)
-add_example (sx6119)
-add_example (si114x)
-add_example (maxsonarez)
-add_example (hm11)
-add_example (ht9170)
-add_example (h3lis331dl)
-add_example (ad8232)
-add_example (grovescam)
-add_example (m24lr64e)
-add_example (rgbringcoder)
-add_example (hp20x)
-add_example (pn532)
-add_example (pn532-writeurl)
-add_example (lsm9ds0)
-add_example (loudness)
-add_example (mg811)
-add_example (wheelencoder)
-add_example (sm130)
-add_example (grovegprs)
-add_example (lm35)
-add_example (micsv89)
-add_example (xbee)
-add_example (urm37)
-add_example (urm37-uart)
-add_example (adxrs610)
-add_example (bma220)
-add_example (dfrph)
-add_example (mcp9808)
-add_example (groveultrasonic)
-add_example (sx1276-lora)
-add_example (sx1276-fsk)
-add_example (ili9341)
-if (OPENZWAVE_FOUND)
- include_directories(${OPENZWAVE_INCLUDE_DIRS})
- add_example (ozw)
-endif()
-add_example (nlgpio16)
-add_example (ads1x15)
-if (MODBUS_FOUND)
- include_directories(${MODBUS_INCLUDE_DIRS})
- add_example (t3311)
- add_example (hwxpxx)
-endif()
-add_example (hdxxvxta)
-add_example (rhusb)
-add_example (apds9930)
-add_example (kxcjk1013)
-add_example (ssd1351)
-
-# These are special cases where you specify example binary, source file and module(s)
-include_directories (${PROJECT_SOURCE_DIR}/src)
-add_custom_example (groveled-multi-example groveled-multi.cxx grove)
-add_custom_example (lcm1602-i2c-example lcm1602-i2c.cxx lcd)
-add_custom_example (lcm1602-parallel-example lcm1602-parallel.cxx lcd)
-add_custom_example (jhd1313m1-lcd-example jhd1313m1-lcd.cxx lcd)
-add_custom_example (es08a-example es08a.cxx servo)
-add_custom_example (ssd1306-oled-example ssd1306-oled.cxx lcd)
-add_custom_example (ssd1308-oled-example ssd1308-oled.cxx lcd)
-add_custom_example (ssd1327-oled-example ssd1327-oled.cxx lcd)
-add_custom_example (sainsmartks-example sainsmartks.cxx lcd)
-add_custom_example (eboled-example eboled.cxx lcd)
-add_custom_example (mpu60x0-example mpu60x0.cxx mpu9150)
-add_custom_example (ak8975-example ak8975.cxx mpu9150)
-add_custom_example (mpu9250-example mpu9250.cxx mpu9150)
-add_custom_example (groveledbar-example groveledbar.cxx my9221)
-add_custom_example (grovecircularled-example grovecircularled.cxx my9221)
diff --git a/peripheral/libupm/examples/c++/a110x-intr.cxx b/peripheral/libupm/examples/c++/a110x-intr.cxx
deleted file mode 100644
index 187c2ed..0000000
--- a/peripheral/libupm/examples/c++/a110x-intr.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "a110x.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-// Our pulse counter
-volatile unsigned int counter = 0;
-
-// Our interrupt handler
-void hallISR(void *arg)
-{
- counter++;
-}
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an A110X sensor on digital pin D2
- upm::A110X* hall = new upm::A110X(2);
-
- // This example uses a user-supplied interrupt handler to count
- // pulses that occur when a magnetic field of the correct polarity
- // is detected. This could be used to measure the rotations per
- // minute (RPM) of a rotor for example.
-
- hall->installISR(hallISR, NULL);
-
- while (shouldRun)
- {
- cout << "Pulses detected: " << counter << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete hall;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/a110x.cxx b/peripheral/libupm/examples/c++/a110x.cxx
deleted file mode 100644
index 30c355d..0000000
--- a/peripheral/libupm/examples/c++/a110x.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "a110x.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an A110X sensor on digital pin D2
- upm::A110X* hall = new upm::A110X(2);
-
- // check every second for the presence of a magnetic field (south
- // polarity)
- while (shouldRun)
- {
- bool val = hall->magnetDetected();
- if (val)
- cout << "Magnet (south polarity) detected." << endl;
- else
- cout << "No magnet detected." << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete hall;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ad8232.cxx b/peripheral/libupm/examples/c++/ad8232.cxx
deleted file mode 100644
index 5d03527..0000000
--- a/peripheral/libupm/examples/c++/ad8232.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "ad8232.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Ad8232 sensor on digital pins 10 (LO+), 11 (LO-)
- // and an analog pin, 0 (OUTPUT)
- upm::AD8232 *ad8232 = new upm::AD8232(10, 11, 0);
-
- // Output the raw numbers from the ADC, for plotting elsewhere.
- // A return of 0 indicates a Lead Off (LO) condition.
- // In theory, this data could be fed to software like Processing
- // (https://www.processing.org/) to plot the data just like an
- // EKG you would see in a hospital.
- while (shouldRun)
- {
- cout << ad8232->value() << endl;
- usleep(1000);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete ad8232;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adafruitms1438-stepper.cxx b/peripheral/libupm/examples/c++/adafruitms1438-stepper.cxx
deleted file mode 100644
index 1bcf75b..0000000
--- a/peripheral/libupm/examples/c++/adafruitms1438-stepper.cxx
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "adafruitms1438.h"
-
-using namespace std;
-using namespace upm;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an Adafruit MS 1438 on I2C bus 0
-
- upm::AdafruitMS1438 *ms =
- new upm::AdafruitMS1438(ADAFRUITMS1438_I2C_BUS,
- ADAFRUITMS1438_DEFAULT_I2C_ADDR);
-
- // Setup for use with a stepper motor connected to the M1 & M2 ports
-
- // set a PWM period of 50Hz
-
- // disable first, to be safe
- ms->disableStepper(AdafruitMS1438::STEPMOTOR_M12);
-
- // configure for a NEMA-17, 200 steps per revolution
- ms->stepConfig(AdafruitMS1438::STEPMOTOR_M12, 200);
-
- // set speed at 10 RPM's
- ms->setStepperSpeed(AdafruitMS1438::STEPMOTOR_M12, 10);
- ms->setStepperDirection(AdafruitMS1438::STEPMOTOR_M12,
- AdafruitMS1438::DIR_CW);
-
- // enable
- cout << "Enabling..." << endl;
- ms->enableStepper(AdafruitMS1438::STEPMOTOR_M12);
-
- cout << "Rotating 1 full revolution at 10 RPM speed." << endl;
- ms->stepperSteps(AdafruitMS1438::STEPMOTOR_M12, 200);
-
- cout << "Sleeping for 2 seconds..." << endl;
- sleep(2);
- cout << "Rotating 1/2 revolution in opposite direction at 10 RPM speed."
- << endl;
-
- ms->setStepperDirection(AdafruitMS1438::STEPMOTOR_M12,
- AdafruitMS1438::DIR_CCW);
- ms->stepperSteps(AdafruitMS1438::STEPMOTOR_M12, 100);
-
- cout << "Disabling..." << endl;
- ms->disableStepper(AdafruitMS1438::STEPMOTOR_M12);
-
- cout << "Exiting" << endl;
-
-//! [Interesting]
-
- delete ms;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adafruitms1438.cxx b/peripheral/libupm/examples/c++/adafruitms1438.cxx
deleted file mode 100644
index 8ca184c..0000000
--- a/peripheral/libupm/examples/c++/adafruitms1438.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "adafruitms1438.h"
-
-using namespace std;
-using namespace upm;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an Adafruit MS 1438 on I2C bus 0
-
- upm::AdafruitMS1438 *ms =
- new upm::AdafruitMS1438(ADAFRUITMS1438_I2C_BUS,
- ADAFRUITMS1438_DEFAULT_I2C_ADDR);
-
- // Setup for use with a DC motor connected to the M3 port
-
- // set a PWM period of 50Hz
- ms->setPWMPeriod(50);
-
- // disable first, to be safe
- ms->disableMotor(AdafruitMS1438::MOTOR_M3);
-
- // set speed at 50%
- ms->setMotorSpeed(AdafruitMS1438::MOTOR_M3, 50);
- ms->setMotorDirection(AdafruitMS1438::MOTOR_M3, AdafruitMS1438::DIR_CW);
-
- cout << "Spin M3 at half speed for 3 seconds, then reverse for 3 seconds."
- << endl;
-
- ms->enableMotor(AdafruitMS1438::MOTOR_M3);
-
- sleep(3);
-
- cout << "Reversing M3" << endl;
- ms->setMotorDirection(AdafruitMS1438::MOTOR_M3, AdafruitMS1438::DIR_CCW);
-
- sleep(3);
-
- cout << "Stopping M3" << endl;
- ms->disableMotor(AdafruitMS1438::MOTOR_M3);
-
- cout << "Exiting" << endl;
-
-//! [Interesting]
-
- delete ms;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adafruitss.cxx b/peripheral/libupm/examples/c++/adafruitss.cxx
deleted file mode 100644
index f2a7ebf..0000000
--- a/peripheral/libupm/examples/c++/adafruitss.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Stan Gifford <stan@gifford.id.au>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * Description
- * Demo program for Adafruit 16 channel servo shield/controller
- * Physical setup for tests is a single servo attached to one channel.
- * Note - when 3 or more GWS servos attached results unpredictable.
- * Adafruit do recommend a Cap be installed on the board which should alleviate the issue.
- * I (and Adafruit) are unable to give any Capacitor sizing data.
- */
-
-#include <iostream>
-#include "adafruitss.h"
-#include <unistd.h>
-
-using namespace std;
-
-int main() {
-
-int n;
-
-//! [Interesting]
- upm::adafruitss* servos = new upm::adafruitss(6,0x40);
-
- for (;;)
- {
- cout << "Setting all to 0" << endl;
- for (n = 0; n < 16; n++)
- servos->servo(n, 1, 0); // GWS Mini Servo = Type 1.
- usleep(1000000); // Wait 1 second
-
- cout << "Setting all to 45" << endl;
- for (n = 0; n < 16; n++)
- servos->servo(n, 1, 45);
- usleep(1000000); // Wait 1 second
-
- cout << "Setting all to 90" << endl;
- for (n = 0; n < 16; n++)
- servos->servo(n, 1, 90);
- usleep(1000000); // Wait 1 second
-
- cout << "Setting all to 135" << endl;
- for (n = 0; n < 16; n++)
- servos->servo(n, 1, 135);
- usleep(1000000); // Wait 1 second
-
- cout << "Setting all to 180" << endl;
- for (n = 0; n < 16; n++)
- servos->servo(n, 1, 160);
- usleep(2000000); // Wait 1 second
- }
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adc121c021.cxx b/peripheral/libupm/examples/c++/adc121c021.cxx
deleted file mode 100644
index 18288ad..0000000
--- a/peripheral/libupm/examples/c++/adc121c021.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "adc121c021.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an ADC121C021 on I2C bus 0
-
- upm::ADC121C021 *adc = new upm::ADC121C021(ADC121C021_I2C_BUS,
- ADC121C021_DEFAULT_I2C_ADDR);
-
- // An analog sensor, such as a Grove light sensor,
- // must be attached to the adc
- // Prints the value and corresponding voltage every 50 milliseconds
- while (shouldRun)
- {
- uint16_t val = adc->value();
- cout << "ADC value: " << val << " Volts = "
- << adc->valueToVolts(val) << endl;
- usleep(50000);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete adc;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adis16448.cxx b/peripheral/libupm/examples/c++/adis16448.cxx
deleted file mode 100644
index a1d4296..0000000
--- a/peripheral/libupm/examples/c++/adis16448.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////////////
-// The MIT License (MIT)
-//
-// Submit Date: 03/09/2015
-// Author: Juan Jose Chong <juanjchong@gmail.com>
-// Copyright (c) 2015 Juan Jose Chong
-//
-//////////////////////////////////////////////////////////////////////////////////////
-// adis16448.cxx
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// This example code runs on an Intel Edison and uses mraa to acquire data
-// from an ADIS16448. This data is then scaled and printed onto the terminal.
-//
-// This software has been tested to connect to an ADIS16448 through a level shifter
-// such as the TI TXB0104. The SPI lines (DIN, DOUT, SCLK, /CS) are all wired through
-// the level shifter and the ADIS16448 is also being powered by the Intel Edison.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "adis16448.h"
-
-int
-main(int argc, char **argv)
-{
- while(true)
- {
- //! [Interesting]
- upm::ADIS16448* imu = new upm::ADIS16448(0,3); //upm::ADIS16448(SPI,RST)
-
- //Read the specified register, scale it, and display it on the screen
- std::cout << "XGYRO_OUT:" << imu->gyroScale(imu->regRead(XGYRO_OUT)) << std::endl;
- std::cout << "YGYRO_OUT:" << imu->gyroScale(imu->regRead(YGYRO_OUT)) << std::endl;
- std::cout << "ZGYRO_OUT:" << imu->gyroScale(imu->regRead(ZGYRO_OUT)) << std::endl;
- std::cout << " " << std::endl;
- std::cout << "XACCL_OUT:" << imu->accelScale(imu->regRead(XACCL_OUT)) << std::endl;
- std::cout << "YACCL_OUT:" << imu->accelScale(imu->regRead(YACCL_OUT)) << std::endl;
- std::cout << "ZACCL_OUT:" << imu->accelScale(imu->regRead(ZACCL_OUT)) << std::endl;
- std::cout << " " << std::endl;
- //! [Interesting]
- sleep(1);
- }
- return (0);
-}
diff --git a/peripheral/libupm/examples/c++/ads1x15.cxx b/peripheral/libupm/examples/c++/ads1x15.cxx
deleted file mode 100644
index 3c5da65..0000000
--- a/peripheral/libupm/examples/c++/ads1x15.cxx
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "mraa.hpp"
-
-#include <iostream>
-#include <unistd.h>
-#include "ads1015.h"
-#include "ads1115.h"
-
-
-
-int main()
-{
-
- using namespace std;
- using namespace upm;
- int command;
- //Select the device you are testing here and adjust case 6 for the correct sample rates.
- //upm::ADS1015 *ads = new upm::ADS1015(1);
- upm::ADS1115 *ads = new upm::ADS1115(1, 0x49);
- float inputVoltage;
- int ans;
-
- do
- {
-
- cout << endl;
- cout << "1 - get Conversion \t" ;
- cout << "2 - get last conversion" << endl;
- cout << "3 - get Gain \t\t";
- cout << "4 - set Gain" << endl;;
- cout << "5 - get Data Rate \t";
- cout << "6 - set Data Rate" << endl;
- cout << "7 - Set Upper Threshold \t" ;
- cout << "8 - Set Lower Threshold \t";
- cout << "9 - Display Thresholds \t";
- cout << "10 - Set Default Thresholds \t";
- cout << "11 - Set conversion ready" << endl;
- cout << "12 - get Comp Que \t" ;
- cout << "13 - set Comp Que" << endl;
- cout << "14 - get Comp Pol \t";
- cout << "15 - set Comp Pol" << endl;
- cout << "16 - get Comp mode \t";
- cout << "17 - set Comp mode " << endl;
- cout << "18 - get Comp Latch\t";
- cout << "19 - set Comp Latch " << endl;
- cout << "20 - get Continuous \t";
- cout << "21 - set Continuous \t" << endl;
- cout << "-1 - exit" << endl;
- cout << "Enter a command: ";
- cin >> command;
-
-
- switch(command)
- {
- case 2:
- cout << ads->getLastSample() << endl;
- break;
- case 3:
- cout << std::hex << ads->getGain() << endl;
- break;
- case 5:
- cout << std::hex << ads->getSPS() << endl;
- break;
- case 4:
- int gain;
- ADS1015::ADSGAIN set_gain;
- cout << "select one of the following:" << endl;
- cout << "1 -> gain 2/3 \t 2 -> gain1 \t 3 -> gain 2" << endl;
- cout << "4 -> gain 4 \t 5 -> gain 8 \t 6 -> gain 15" << endl;
- cin >> gain;
- switch(gain){
- case 1:
- set_gain = ADS1X15::GAIN_TWOTHIRDS;
- break;
- case 2:
- set_gain = ADS1X15::GAIN_ONE;
- break;
- case 3:
- set_gain = ADS1X15::GAIN_TWO;
- break;
- case 4:
- set_gain = ADS1X15::GAIN_FOUR;
- break;
- case 5:
- set_gain = ADS1X15::GAIN_EIGHT;
- break;
- case 6:
- set_gain = ADS1X15::GAIN_SIXTEEN;
- break;
- default:
- set_gain = ADS1X15::GAIN_ONE;
- }
- ads->setGain(set_gain);
- break;
- case 6:
- int rate;
- /*ADS1015::ADSDATARATE set_rate;
- cout << "select one of the following:" << endl;
- cout << "1 -> SPS_120 \t 2 -> SPS_250 \t 3 -> SPS_490 \t 4 -> SPS_920" << endl;
- cout << "5 -> SPS_1600 \t 6 -> SPS_2400 \t 7 -> SPS_3300" << endl;
- cin >> rate;
- switch(rate){
- case 1:
- set_rate = ADS1015::SPS_128;
- break;
- case 2:
- set_rate = ADS1015::SPS_250;
- break;
- case 3:
- set_rate = ADS1015::SPS_490;
- break;
- case 4:
- set_rate = ADS1015::SPS_920;
- break;
- case 5:
- set_rate = ADS1015::SPS_1600;
- break;
- case 6:
- set_rate = ADS1015::SPS_2400;
- break;
- case 7:
- set_rate = ADS1015::SPS_3300;
- break;
- default:
- set_rate = ADS1015::SPS_1600;
- } */
- ADS1115::ADSDATARATE set_rate;
- cout << "select one of the following:" << endl;
- cout << "1 -> SPS_8 \t 2 -> SPS_16 \t 3 -> SPS_32 \t 4 -> SPS_64" << endl;
- cout << "5 -> SPS_128 \t 6 -> SPS_250 \t 7 -> SPS_475 \t 8-> SPS_860" << endl;
- cin >> rate;
- switch(rate){
- case 1:
- set_rate = ADS1115::SPS_8;
- break;
- case 2:
- set_rate = ADS1115::SPS_16;
- break;
- case 3:
- set_rate = ADS1115::SPS_32;
- break;
- case 4:
- set_rate = ADS1115::SPS_64;
- break;
- case 5:
- set_rate = ADS1115::SPS_128;
- break;
- case 6:
- set_rate = ADS1115::SPS_250;
- break;
- case 7:
- set_rate = ADS1115::SPS_475;
- break;
- case 8:
- set_rate = ADS1115::SPS_860;
- break;
- default:
- set_rate = ADS1115::SPS_128;
- }
-
- ads->setSPS(set_rate);
- break;
- case 1:
- int mode;
- ADS1X15::ADSMUXMODE set_mode;
- cout << "select one of the following:" << endl;
- cout << "1 -> MUX_0_1 \t 2 -> MUX_0_3 \t 3 -> MUX_1_3 \t 4 -> MUX_2_3" << endl;
- cout << "5 -> SINGLE_0 \t 6 -> SINGLE_1 \t 7 -> SINGLE_2 \t 8 -> SINGLE_3" << endl;
- cin >> mode;
- switch(mode){
- case 1:
- set_mode = ADS1X15::DIFF_0_1;
- break;
- case 2:
- set_mode = ADS1X15::DIFF_0_3;
- break;
- case 3:
- set_mode = ADS1X15::DIFF_1_3;
- break;
- case 4:
- set_mode = ADS1X15::DIFF_2_3;
- break;
- case 5:
- set_mode = ADS1X15::SINGLE_0;
- break;
- case 6:
- set_mode = ADS1X15::SINGLE_1;
- break;
- case 7:
- set_mode = ADS1X15::SINGLE_2;
- break;
- case 8:
- set_mode = ADS1X15::SINGLE_3;
- break;
- default:
- set_mode = ADS1X15::DIFF_0_1;
- break;
- }
- cout << ads->getSample(set_mode) << endl;
- break;
- case 7:
- cout << " enter a float value: " ;
- cin >> inputVoltage;
- ads->setThresh(ADS1115::THRESH_HIGH, inputVoltage);
- break;
- case 8:
- cout << " enter a float value: " ;
- cin >> inputVoltage;
- ads->setThresh(ADS1115::THRESH_LOW, inputVoltage);
- break;
- case 9:
- cout << "Upper " << ads->getThresh(ADS1X15::THRESH_HIGH) << endl;
- cout << "Lower " << ads->getThresh(ADS1X15::THRESH_LOW) << endl;
- break;
- case 10:
- ads->setThresh(ADS1115::THRESH_DEFAULT);
- break;
- case 11:
- ads->setThresh(ADS1015::CONVERSION_RDY);
- break;
- case 12:
- cout << ads->getCompQue() << endl;
- break;
- case 13:
- int que;
- cout << "select one of the following:" << endl;
- cout << "1 -> CQUE_1CONV \t 2 -> CQUE_2CONV \t 3 -> CQUE_3CONV \t 4 -> CQUE_NONE" << endl;
- cin >> que;
- switch(que){
- case 1:
- ads->setCompQue(ADS1X15::CQUE_1CONV);
- break;
- case 2:
- ads->setCompQue(ADS1X15::CQUE_2CONV);
- break;
- case 3:
- ads->setCompQue(ADS1X15::CQUE_4CONV);
- break;
- case 4:
- default:
- ads->setCompQue(ADS1X15::CQUE_NONE);
- break;
- }
- break;
- case 14:
- cout << ads->getCompPol() << endl;
- break;
- case 15:
- cout << "select one of the following:" << endl;
- cout << "1 -> active high \t 2 -> active low" << endl;
- cin >> ans;
- if(ans == 1) ads->setCompPol(true);
- else ads->setCompPol(false);
- break;
- case 16:
- cout << ads->getCompMode() << endl;
- break;
- case 17:
- cout << "select one of the following:" << endl;
- cout << "1 -> Window \t 2 -> Traditional (default)" << endl;
- cin >> ans;
- if(ans == 1) ads->setCompMode(true);
- else ads->setCompMode();
- break;
- case 18:
- cout << ads->getCompLatch() << cout;
- break;
- case 19:
- cout << "select one of the following:" << endl;
- cout << "1 -> Latching \t 2 -> Non-latching (default)" << endl;
- cin >> ans;
- if(ans == 1) ads->setCompLatch(true);
- else ads->setCompLatch();
- break;
- case 20:
- cout << ads->getContinuous() << cout;
- break;
- case 21:
- cout << "select one of the following:" << endl;
- cout << "1 -> Power Down (default) \t 2 -> Continuous" << endl;
- cin >> ans;
- if(ans == 1) ads->setContinuous(true);
- else ads->setContinuous();
- break;
- case -1:
- break;
- default:
-
- break;
- }
-
- }while (command != -1 );
-
- delete ads;
-
- return MRAA_SUCCESS;
-}
diff --git a/peripheral/libupm/examples/c++/adxl335.cxx b/peripheral/libupm/examples/c++/adxl335.cxx
deleted file mode 100644
index 471695d..0000000
--- a/peripheral/libupm/examples/c++/adxl335.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "adxl335.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an ADXL335 accelerometer on analog pins A0, A1, and A2
- upm::ADXL335* accel = new upm::ADXL335(0, 1, 2);
-
- cout << "Please make sure the sensor is completely still. Sleeping for"
- << " 2 seconds." << endl;
- sleep(2);
- cout << "Calibrating..." << endl;
-
- accel->calibrate();
-
- while (shouldRun)
- {
- int x, y, z;
- float aX, aY, aZ;
-
- accel->values(&x, &y, &z);
- cout << "Raw Values: X: " << x << " Y: " << y << " Z: " << z << endl;
-
- accel->acceleration(&aX, &aY, &aZ);
- cout << "Acceleration: X: " << aX << "g" << endl;
- cout << "Acceleration: Y: " << aY << "g" << endl;
- cout << "Acceleration: Z: " << aZ << "g" << endl;
- cout << endl;
-
- usleep(200000);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete accel;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adxl345.cxx b/peripheral/libupm/examples/c++/adxl345.cxx
deleted file mode 100644
index a5bc2cc..0000000
--- a/peripheral/libupm/examples/c++/adxl345.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include "adxl345.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- int16_t *raw;
- float *acc;
-
- // Note: Sensor only works at 3.3V on the Intel Edison with Arduino breakout
- upm::Adxl345* accel = new upm::Adxl345(0);
-
- while(true){
- accel->update(); // Update the data
- raw = accel->getRawValues(); // Read raw sensor data
- acc = accel->getAcceleration(); // Read acceleration (g)
- fprintf(stdout, "Current scale: 0x%2xg\n", accel->getScale());
- fprintf(stdout, "Raw: %6d %6d %6d\n", raw[0], raw[1], raw[2]);
- fprintf(stdout, "AccX: %5.2f g\n", acc[0]);
- fprintf(stdout, "AccY: %5.2f g\n", acc[1]);
- fprintf(stdout, "AccZ: %5.2f g\n", acc[2]);
- sleep(1);
- }
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/adxrs610.cxx b/peripheral/libupm/examples/c++/adxrs610.cxx
deleted file mode 100644
index 4ec53ef..0000000
--- a/peripheral/libupm/examples/c++/adxrs610.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "adxrs610.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a ADXRS610 sensor on analog pin A0 (dataout), and
- // analog A1 (temp out) with an analog reference voltage of
- // 5.0
- upm::ADXRS610 *sensor = new upm::ADXRS610(0, 1, 5.0);
-
- // set a deadband region around the zero point to report 0.0 (optional)
- sensor->setDeadband(0.015);
-
- // Every tenth of a second, sample the ADXRS610 and output it's
- // corresponding temperature and angular velocity
-
- while (shouldRun)
- {
- cout << "Vel (deg/s): " << sensor->getAngularVelocity() << endl;
- cout << "Temp (C): " << sensor->getTemperature() << endl;
-
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ak8975.cxx b/peripheral/libupm/examples/c++/ak8975.cxx
deleted file mode 100644
index 1b95ead..0000000
--- a/peripheral/libupm/examples/c++/ak8975.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mpu9150.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- upm::AK8975 *sensor = new upm::AK8975();
-
- sensor->init();
-
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getMagnetometer(&x, &y, &z);
- cout << "Magnetometer: ";
- cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
-
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/am2315.cxx b/peripheral/libupm/examples/c++/am2315.cxx
deleted file mode 100644
index 4b95e1c..0000000
--- a/peripheral/libupm/examples/c++/am2315.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "am2315.h"
-
-volatile int doWork = 0;
-
-upm::AM2315 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- printf("\nCtrl-C received.\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- // Register signal handler
- signal(SIGINT, sig_handler);
-
- //! [Interesting]
- float humidity = 0.0;
- float temperature = 0.0;
-
- sensor = new upm::AM2315(0, AM2315_I2C_ADDRESS);
-
- sensor->testSensor();
-
- while (!doWork) {
- humidity = sensor->getHumidity();
- temperature = sensor->getTemperature();
-
- std::cout << "humidity value = " <<
- humidity <<
- ", temperature value = " <<
- temperature << std::endl;
- usleep (500000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/apds9002.cxx b/peripheral/libupm/examples/c++/apds9002.cxx
deleted file mode 100644
index 87b5070..0000000
--- a/peripheral/libupm/examples/c++/apds9002.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "apds9002.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Luminance sensor on analog pin A0
- upm::APDS9002* luminance = new upm::APDS9002(0);
-
- while (shouldRun)
- {
- int val = luminance->value();
- cout << "Luminance value is " << val << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete luminance;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/apds9930.cxx b/peripheral/libupm/examples/c++/apds9930.cxx
deleted file mode 100644
index 8d461c9..0000000
--- a/peripheral/libupm/examples/c++/apds9930.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Author: Lay, Kuan Loon <kuan.loon.lay@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "apds9930.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int
-main()
-{
- signal(SIGINT, sig_handler);
- //! [Interesting]
- // Instantiate a Digital Proximity and Ambient Light sensor on iio device 4
- upm::APDS9930* light_proximity = new upm::APDS9930(4);
-
- while (shouldRun) {
- float lux = light_proximity->getAmbient();
- cout << "Luminance value is " << lux << endl;
- float proximity = light_proximity->getProximity();
- cout << "Proximity value is " << proximity << endl;
- sleep(1);
- }
- //! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete light_proximity;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/at42qt1070.cxx b/peripheral/libupm/examples/c++/at42qt1070.cxx
deleted file mode 100644
index c22a998..0000000
--- a/peripheral/libupm/examples/c++/at42qt1070.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "at42qt1070.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-void printButtons(upm::AT42QT1070 *touch)
-{
- bool buttonPressed = false;
- uint8_t buttons = touch->getButtons();
-
- cout << "Buttons Pressed: ";
- for (int i=0; i<7; i++)
- {
- if (buttons & (1 << i))
- {
- cout << i << " ";
- buttonPressed = true;
- }
- }
-
- if (!buttonPressed)
- cout << "None";
-
- cout << endl;
-
- if (touch->isCalibrating())
- cout << "Calibration is occurring." << endl;
-
- if (touch->isOverflowed())
- cout << "Overflow was detected." << endl;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an AT42QT1070 on I2C bus 0
-
- upm::AT42QT1070 *touch = new upm::AT42QT1070(AT42QT1070_I2C_BUS,
- AT42QT1070_DEFAULT_I2C_ADDR);
-
- while (shouldRun)
- {
- touch->updateState();
- printButtons(touch);
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete touch;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/biss0001.cxx b/peripheral/libupm/examples/c++/biss0001.cxx
deleted file mode 100644
index 1574c2f..0000000
--- a/peripheral/libupm/examples/c++/biss0001.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "biss0001.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Motion sensor on GPIO pin D2
- upm::BISS0001* motion = new upm::BISS0001(2);
-
- while (shouldRun)
- {
- bool val = motion->value();
-
- if (val)
- cout << "Detecting moving object";
- else
- cout << "No moving objects detected";
-
- cout << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete motion;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/bma220.cxx b/peripheral/libupm/examples/c++/bma220.cxx
deleted file mode 100644
index a41b81a..0000000
--- a/peripheral/libupm/examples/c++/bma220.cxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "bma220.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- // Instantiate an BMA220 using default parameters (bus 0, addr 0x0a)
- upm::BMA220 *sensor = new upm::BMA220();
-
- // Output data every half second until interrupted
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getAccelerometer(&x, &y, &z);
- cout << "Accelerometer: ";
- cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/bmpx8x.cxx b/peripheral/libupm/examples/c++/bmpx8x.cxx
deleted file mode 100644
index 28e5be8..0000000
--- a/peripheral/libupm/examples/c++/bmpx8x.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "bmpx8x.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::BMPX8X *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- uint32_t presure = 0;
- float temperature = 0;
- float altitude = 0;
- uint32_t sealevel = 0;
-
- // Instantiate a BMPX8X sensor on I2C
- sensor = new upm::BMPX8X(0, ADDR);
-
- // Print the pressure, altitude, sea level, and
- // temperature values every 0.1 seconds
- while (!doWork) {
- presure = sensor->getPressure ();
- temperature = sensor->getTemperature ();
- altitude = sensor->getAltitude ();
- sealevel = sensor->getSealevelPressure ();
-
- std::cout << "pressure value = " <<
- presure <<
- ", altitude value = " <<
- altitude <<
- ", sealevel value = " <<
- sealevel <<
- ", temperature = " <<
- temperature << std::endl;
- usleep (100000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/buzzer-sound.cxx b/peripheral/libupm/examples/c++/buzzer-sound.cxx
deleted file mode 100644
index 1d377ba..0000000
--- a/peripheral/libupm/examples/c++/buzzer-sound.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "buzzer.h"
-
-
-int
-main(int argc, char **argv) {
- //! [Interesting]
- int chord[] = { DO, RE, MI, FA, SOL, LA, SI, DO, SI };
-
- // create Buzzer instance
- upm::Buzzer* sound = new upm::Buzzer(5);
- // print sensor name
- std::cout << sound->name() << std::endl;
-
- // play sound (DO, RE, MI, etc...), pausing for 0.1 seconds between notes
- for (int chord_ind = 0; chord_ind < 7; chord_ind++) {
- // play each note for one second
- std::cout << sound->playSound(chord[chord_ind], 1000000) << std::endl;
- usleep(100000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sound;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/cjq4435.cxx b/peripheral/libupm/examples/c++/cjq4435.cxx
deleted file mode 100644
index f9d84d4..0000000
--- a/peripheral/libupm/examples/c++/cjq4435.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "cjq4435.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3
- upm::CJQ4435* mosfet = new upm::CJQ4435(3);
-
- mosfet->setPeriodMS(10);
- mosfet->enable(true);
-
- while (shouldRun)
- {
- // start with a duty cycle of 0.0 (off) and increment to 1.0 (on)
- for (float i=0.0; i <= 1.0; i+=0.1)
- {
- mosfet->setDutyCycle(i);
- usleep(100000);
- }
- sleep(1);
- // Now take it back down
- // start with a duty cycle of 1.0 (on) and decrement to 0.0 (off)
- for (float i=1.0; i >= 0.0; i-=0.1)
- {
- mosfet->setDutyCycle(i);
- usleep(100000);
- }
- sleep(1);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete mosfet;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/dfrph.cxx b/peripheral/libupm/examples/c++/dfrph.cxx
deleted file mode 100644
index 601fdbf..0000000
--- a/peripheral/libupm/examples/c++/dfrph.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "dfrph.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-#define DFRPH_AREF 5.0
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a DFRPH sensor on analog pin A0, with an analog
- // reference voltage of DFRPH_AREF
- upm::DFRPH *sensor = new upm::DFRPH(0, DFRPH_AREF);
-
-
- // After calibration, set the offset (based on calibration with a pH
- // 7.0 buffer solution). See the UPM sensor documentation for
- // calibrations instructions.
- sensor->setOffset(0.065);
-
- // Every second, sample the pH and output it's corresponding
- // analog voltage.
-
- while (shouldRun)
- {
- cout << "Detected volts: " << sensor->volts() << endl;
- cout << "pH value: " << sensor->pH() << endl;
- cout << endl;
-
- sleep(1);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ds1307.cxx b/peripheral/libupm/examples/c++/ds1307.cxx
deleted file mode 100644
index 44a0b08..0000000
--- a/peripheral/libupm/examples/c++/ds1307.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "ds1307.h"
-
-using namespace std;
-
-void printTime(upm::DS1307 *rtc)
-{
- cout << "The time is: " <<
- rtc->month << "/" << rtc->dayOfMonth << "/" << rtc->year << " "
- << rtc->hours << ":" << rtc->minutes << ":" << rtc->seconds;
-
- if (rtc->amPmMode)
- cout << (rtc->pm) ? " PM " : " AM ";
-
- cout << endl;
-
- cout << "Clock is in " << ((rtc->amPmMode) ? "AM/PM mode" : "24hr mode")
- << endl;
-}
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a DS1037 on I2C bus 0
- upm::DS1307 *rtc = new upm::DS1307(0);
-
- // always do this first
- cout << "Loading the current time... " << endl;
- if (!rtc->loadTime())
- {
- cerr << "rtc->loadTime() failed." << endl;
- return 0;
- }
-
- printTime(rtc);
-
- // set the year as an example
- cout << "setting the year to 50" << endl;
- rtc->year = 50;
-
- rtc->setTime();
-
- // reload the time and print it
- rtc->loadTime();
- printTime(rtc);
-
- //! [Interesting]
-
- delete rtc;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/eboled.cxx b/peripheral/libupm/examples/c++/eboled.cxx
deleted file mode 100644
index c1c281c..0000000
--- a/peripheral/libupm/examples/c++/eboled.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include "eboled.h"
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an Edison Block OLED using default values
- upm::EBOLED *lcd = new upm::EBOLED();
-
- lcd->clear();
- lcd->setCursor(10, 15);
- lcd->write("Hello");
- lcd->setCursor(30, 15);
- lcd->write("World!");
- lcd->refresh();
-
- cout << "Sleeping for 5 seconds..." << endl;
- sleep(5);
-
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ecs1030.cxx b/peripheral/libupm/examples/c++/ecs1030.cxx
deleted file mode 100644
index 40a7dc5..0000000
--- a/peripheral/libupm/examples/c++/ecs1030.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdlib.h>
-#include "ecs1030.h"
-
-int is_running = 0;
-upm::ECS1030 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- sensor = new upm::ECS1030(0);
- signal(SIGINT, sig_handler);
-
- while (!is_running) {
- std::cout << "I = " << sensor->getCurrency_A () << ", Power = " << sensor->getPower_A () << std::endl;
- std::cout << "I = " << sensor->getCurrency_B () << ", Power = " << sensor->getPower_B () << std::endl;
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/enc03r.cxx b/peripheral/libupm/examples/c++/enc03r.cxx
deleted file mode 100644
index da0db9b..0000000
--- a/peripheral/libupm/examples/c++/enc03r.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "enc03r.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-// analog voltage, usually 3.3 or 5.0
-#define CALIBRATION_SAMPLES 1000
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a ENC03R on analog pin A0
- upm::ENC03R *gyro = new upm::ENC03R(0);
-
- // The first thing we need to do is calibrate the sensor.
- cout << "Please place the sensor in a stable location, and do not" << endl;
- cout << "move it while calibration takes place." << endl;
- cout << "This may take a couple of minutes." << endl;
-
- gyro->calibrate(CALIBRATION_SAMPLES);
- cout << "Calibration complete. Reference value: "
- << gyro->calibrationValue() << endl;
-
- // Read the input and print both the raw value and the angular velocity,
- // waiting 0.1 seconds between readings
- while (shouldRun)
- {
- unsigned int val = gyro->value();
- double av = gyro->angularVelocity(val);
-
- cout << "Raw value: " << val << ", "
- << "angular velocity: " << av << " deg/s" << endl;
-
- usleep(100000);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete gyro;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/es08a.cxx b/peripheral/libupm/examples/c++/es08a.cxx
deleted file mode 100644
index 3f7e5c4..0000000
--- a/peripheral/libupm/examples/c++/es08a.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "es08a.h"
-#include <signal.h>
-#include <stdlib.h>
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- upm::ES08A *servo = new upm::ES08A(5);
-
- // Sets the shaft to 180, then to 90, then to 0,
- // then back to 90, and finally back to 180,
- // pausing for a second in between each angle
- servo->setAngle (180);
- std::cout << "Set angle to 180" << std::endl;
- sleep(1);
- servo->setAngle (90);
- std::cout << "Set angle to 90" << std::endl;
- sleep(1);
- servo->setAngle (0);
- std::cout << "Set angle to 0" << std::endl;
- sleep(1);
- servo->setAngle (90);
- std::cout << "Set angle to 90" << std::endl;
- sleep(1);
- servo->setAngle (180);
- std::cout << "Set angle to 180" << std::endl;
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete servo;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/flex.cxx b/peripheral/libupm/examples/c++/flex.cxx
deleted file mode 100644
index 5477338..0000000
--- a/peripheral/libupm/examples/c++/flex.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "flex.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with a Spectra Symbol flex sensor.
- // We attached a 22K resistor to a breadboard,
- // with 1 end attached to GND and the other connected to
- // both the flex sensor and A0.
- // The flex sensor was connected on 1 pin to the 22K resistor and A0
- // and on the other pin to 5V.
-
- // Instantiate a Flex sensor on analog pin A0
- upm::Flex *flex = new upm::Flex(0);
-
- while (shouldRun)
- {
- cout << "Flex value: " << flex->value() << endl;
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete flex;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/gp2y0a.cxx b/peripheral/libupm/examples/c++/gp2y0a.cxx
deleted file mode 100644
index 0111b17..0000000
--- a/peripheral/libupm/examples/c++/gp2y0a.cxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "gp2y0a.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-// analog voltage, usually 3.3 or 5.0
-#define GP2Y0A_AREF 5.0
-#define SAMPLES_PER_QUERY 20
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Note, for the Grove 80cm version of this sensor, due to the way
- // it is wired, you need to plug this into the A0 port, where it
- // will use the available A1 pin for data.
-
- // Instantiate a GP2Y0A on analog pin A1
- upm::GP2Y0A *volts = new upm::GP2Y0A(1);
-
- // The higher the voltage (closer to AREF) the closer the object is. NOTE:
- // the measured voltage will probably not exceed 3.3 volts.
- // Every second, print the averaged voltage value (averaged over 20 samples).
- while (shouldRun)
- {
- cout << "AREF: " << GP2Y0A_AREF
- << ", Voltage value (higher means closer): "
- << volts->value(GP2Y0A_AREF, SAMPLES_PER_QUERY) << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete volts;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovebutton.cxx b/peripheral/libupm/examples/c++/grovebutton.cxx
deleted file mode 100644
index 7d2d69a..0000000
--- a/peripheral/libupm/examples/c++/grovebutton.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "grove.h"
-
-int
-main(int argc, char **argv)
-{
- // This example uses GPIO 0
-//! [Interesting]
-
- // Create the button object using GPIO pin 0
- upm::GroveButton* button = new upm::GroveButton(0);
-
- // Read the input and print, waiting one second between readings
- while( 1 ) {
- std::cout << button->name() << " value is " << button->value() << std::endl;
- sleep(1);
- }
-
- // Delete the button object
- delete button;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovecircularled.cxx b/peripheral/libupm/examples/c++/grovecircularled.cxx
deleted file mode 100644
index 066e017..0000000
--- a/peripheral/libupm/examples/c++/grovecircularled.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovecircularled.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a Grove Circular LED on D9 for data, D8 for clock
-
- upm::GroveCircularLED *circle = new upm::GroveCircularLED(9, 8);
-
- int level = 0;
- while (shouldRun)
- {
- circle->setSpinner(level);
- level = (level + 1) % 24;
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete circle;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovecollision.cxx b/peripheral/libupm/examples/c++/grovecollision.cxx
deleted file mode 100644
index 2de7609..0000000
--- a/peripheral/libupm/examples/c++/grovecollision.cxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <iostream>
-#include <unistd.h>
-#include <signal.h>
-#include "grovecollision.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the Grove Collision Sensor
- // Instantiate a Grove Collision on digital pin D2
- upm::GroveCollision* collision = new upm::GroveCollision(2);
-
- bool collisionState = false;
- cout << "No collision" << endl;
- while (shouldRun)
- {
- if (collision->isColliding() && !collisionState)
- {
- cout << "Collision!" << endl;
- collisionState = true;
- }
- else if (collisionState)
- {
- cout << "No collision" << endl;
- collisionState = false;
- }
- }
-
-//! [Interesting]
- cout << "Exiting" << endl;
-
- delete collision;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveehr.cxx b/peripheral/libupm/examples/c++/groveehr.cxx
deleted file mode 100644
index b056a15..0000000
--- a/peripheral/libupm/examples/c++/groveehr.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "groveehr.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2
- upm::GroveEHR* heart = new upm::GroveEHR(2);
-
- // set the beat counter to 0, init the clock and start counting beats
- heart->clearBeatCounter();
- heart->initClock();
- heart->startBeatCounter();
-
- while (shouldRun)
- {
- // we grab these just for display purposes in this example
- uint32_t millis = heart->getMillis();
- uint32_t beats = heart->beatCounter();
-
- // heartRate() requires that at least 5 seconds pass before
- // returning anything other than 0
- int hr = heart->heartRate();
-
- // output milliseconds passed, beat count, and computed heart rate
- cout << "Millis: " << millis << " Beats: " << beats;
- cout << " Heart Rate: " << hr << endl;
-
- sleep(1);
- }
-
- heart->stopBeatCounter();
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete heart;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveeldriver.cxx b/peripheral/libupm/examples/c++/groveeldriver.cxx
deleted file mode 100644
index 126eaaf..0000000
--- a/peripheral/libupm/examples/c++/groveeldriver.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <iostream>
-#include <unistd.h>
-#include <signal.h>
-#include "groveeldriver.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the Grove El Driver Module
- // Instantiate a Grove El Driver on digital pin D2
- upm::GroveElDriver* eldriver = new upm::GroveElDriver(2);
-
- bool lightState = true;
-
- while (shouldRun)
- {
- if (lightState)
- eldriver->on();
- else
- eldriver->off();
- lightState = !lightState;
- sleep(1);
- }
-
-//! [Interesting]
- eldriver->off();
- cout << "Exiting" << endl;
-
- delete eldriver;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveelectromagnet.cxx b/peripheral/libupm/examples/c++/groveelectromagnet.cxx
deleted file mode 100644
index 386f4de..0000000
--- a/peripheral/libupm/examples/c++/groveelectromagnet.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <iostream>
-#include <time.h>
-#include <signal.h>
-#include "groveelectromagnet.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-float get_time()
-{
- return ((float)(clock()))/CLOCKS_PER_SEC;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the Grove Electromagnetic Module
- // Instantiate a Grove Electromagnet on digital pin D2
- upm::GroveElectromagnet* magnet = new upm::GroveElectromagnet(2);
- cout << "Starting up magnet...." << endl;
- magnet->off();
-
- bool magnetState = false;
- float time_passed = get_time();
-
- // Turn magnet on and off every 5 seconds
- while (shouldRun)
- {
- if ((get_time() - time_passed) > 5.0)
- {
- magnetState = !magnetState;
- if (magnetState)
- magnet->on();
- else
- magnet->off();
- cout << "Turning magnet " << ((magnetState) ? "on" : "off") << endl;
- time_passed = get_time();
- }
- }
-
-//! [Interesting]
- magnet->off();
- cout << "Exiting" << endl;
-
- delete magnet;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveemg.cxx b/peripheral/libupm/examples/c++/groveemg.cxx
deleted file mode 100644
index d06295a..0000000
--- a/peripheral/libupm/examples/c++/groveemg.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "groveemg.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the GroveEMG Muscle Signal Reader Sensor Module
- // Instantiate a GroveEMG on analog pin A0
- upm::GroveEMG *emg = new upm::GroveEMG(0);
- cout << "Calibrating...." << endl;
- emg->calibrate();
-
- while (shouldRun)
- {
- cout << emg->value() << endl;
- usleep(100000);
- }
-
-//! [Interesting]
- cout << "Exiting" << endl;
- delete emg;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovegprs.cxx b/peripheral/libupm/examples/c++/grovegprs.cxx
deleted file mode 100644
index bc0e3d9..0000000
--- a/peripheral/libupm/examples/c++/grovegprs.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdio.h>
-#include "grovegprs.h"
-
-using namespace std;
-using namespace upm;
-
-void printUsage(char *progname)
-{
- cout << "Usage: " << progname << " [AT command]" << endl;
- cout << endl;
-
- cout << "If an argument is supplied on the command line, that argument is"
- << endl;
- cout << "sent to the module and the response is printed out." << endl;
- cout << endl;
- cout << "If no argument is used, then the manufacturer and the current"
- << endl;
- cout << "saved profiles are queried and the results printed out." << endl;
- cout << endl;
- cout << endl;
-}
-
-// simple helper function to send a command and wait for a response
-void sendCommand(upm::GroveGPRS* sensor, string cmd)
-{
- // commands need to be terminated with a carriage return
- cmd += "\r";
-
- sensor->writeDataStr(cmd);
-
- // wait up to 1 second
- if (sensor->dataAvailable(1000))
- {
- cout << "Returned: " << sensor->readDataStr(1024) << endl;
- }
- else
- {
- cerr << "Timed out waiting for response" << endl;
- }
-}
-
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
-
- // Instantiate a GroveGPRS Module on UART 0
- upm::GroveGPRS* sensor = new upm::GroveGPRS(0);
-
- // Set the baud rate, 19200 baud is the default.
- if (sensor->setBaudRate(19200) != mraa::SUCCESS)
- {
- cerr << "Failed to set tty baud rate" << endl;
- return 1;
- }
-
- printUsage(argv[0]);
-
- if (argc > 1)
- {
- cout << "Sending command line argument (" << argv[1] << ")..." << endl;
- sendCommand(sensor, argv[1]);
- }
- else
- {
- // query the module manufacturer
- cout << "Querying module manufacturer (AT+CGMI)..." << endl;
- sendCommand(sensor, "AT+CGMI");
-
- sleep(1);
-
- // query the saved profiles
- cout << "Querying the saved profiles (AT&V)..." << endl;
- sendCommand(sensor, "AT&V");
-
- // A comprehensive list is available from the datasheet at:
- // http://www.seeedstudio.com/wiki/images/7/72/AT_Commands_v1.11.pdf
- }
-
-//! [Interesting]
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovegsr.cxx b/peripheral/libupm/examples/c++/grovegsr.cxx
deleted file mode 100644
index 549e775..0000000
--- a/peripheral/libupm/examples/c++/grovegsr.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovegsr.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the GroveGSR Galvanic Skin Response Sensor module.
-
- // Instantiate a GroveGSR on analog pin A0
- upm::GroveGSR *gsr = new upm::GroveGSR(0);
- cout << "Calibrating...." << endl;
- gsr->calibrate();
-
- while (shouldRun)
- {
- cout << gsr->value() << endl;
- usleep(500000);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete gsr;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveled-multi.cxx b/peripheral/libupm/examples/c++/groveled-multi.cxx
deleted file mode 100644
index 16a6eba..0000000
--- a/peripheral/libupm/examples/c++/groveled-multi.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014-2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grove.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a grove LED on D2. Here we are controlling a Grove
- // Multi-color flash LED. We just just need to turn it on - it will
- // then cycle through various colors (red, green, blue, purple) on it's
- // own until turned off.
- upm::GroveLed* led = new upm::GroveLed(2);
-
- // start the light show
- led->on();
-
- // just sleep until interrupted
- while (shouldRun)
- sleep(1);
-
-//! [Interesting]
-
- led->off();
- cout << "Exiting..." << endl;
-
- delete led;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveled.cxx b/peripheral/libupm/examples/c++/groveled.cxx
deleted file mode 100644
index 52d5e84..0000000
--- a/peripheral/libupm/examples/c++/groveled.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "grove.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
-
- // Create the Grove LED object using GPIO pin 2
- upm::GroveLed* led = new upm::GroveLed(2);
-
- // Print the name
- std::cout << led->name() << std::endl;
-
- // Turn the LED on and off 10 times, pausing one second
- // between transitions
- for (int i=0; i < 10; i++) {
- led->on();
- sleep(1);
- led->off();
- sleep(1);
- }
-
- // Delete the Grove LED object
- delete led;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveledbar.cxx b/peripheral/libupm/examples/c++/groveledbar.cxx
deleted file mode 100644
index d86110c..0000000
--- a/peripheral/libupm/examples/c++/groveledbar.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "groveledbar.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a GroveLEDBar, we use D8 for the data, and D9 for the
- // clock. This was tested with a Grove LED bar.
- upm::GroveLEDBar* bar = new upm::GroveLEDBar(8, 9);
-
- while (shouldRun)
- {
- // count up from green to red
- for (int i=0; i<=10; i++)
- {
- bar->setBarLevel(i, true);
- usleep(100000);
- }
- sleep(1);
-
- // count down from red to green
- for (int i=0; i<=10; i++)
- {
- bar->setBarLevel(i, false);
- usleep(100000);
- }
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
- // turn off the LED's
- bar->setBarLevel(0);
-
- delete bar;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovelight.cxx b/peripheral/libupm/examples/c++/grovelight.cxx
deleted file mode 100644
index 64760c9..0000000
--- a/peripheral/libupm/examples/c++/grovelight.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "grove.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- // Create the light sensor object using AIO pin 0
- upm::GroveLight* light = new upm::GroveLight(0);
-
- // Read the input and print both the raw value and a rough lux value,
- // waiting one second between readings
- while( 1 ) {
- std::cout << light->name() << " raw value is " << light->raw_value() <<
- ", which is roughly " << light->value() << " lux" << std::endl;
- sleep(1);
- }
-
- // Delete the light sensor object
- delete light;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovelinefinder.cxx b/peripheral/libupm/examples/c++/grovelinefinder.cxx
deleted file mode 100644
index a8290c5..0000000
--- a/peripheral/libupm/examples/c++/grovelinefinder.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovelinefinder.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Line Finder sensor on digital pin D2
- upm::GroveLineFinder* finder = new upm::GroveLineFinder(2);
-
- // check every second for the presence of white detection
- while (shouldRun)
- {
- bool val = finder->whiteDetected();
- if (val)
- cout << "White detected." << endl;
- else
- cout << "Black detected." << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete finder;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovemd-stepper.cxx b/peripheral/libupm/examples/c++/grovemd-stepper.cxx
deleted file mode 100644
index f65c5e4..0000000
--- a/peripheral/libupm/examples/c++/grovemd-stepper.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "grovemd.h"
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
- //! [Interesting]
- // Instantiate an I2C Grove Motor Driver on I2C bus 0
-
- upm::GroveMD *motors = new upm::GroveMD(GROVEMD_I2C_BUS,
- GROVEMD_DEFAULT_I2C_ADDR);
-
- // This example demonstrates using the GroveMD to drive a stepper motor
-
- // configure it, for this example, we'll assume 200 steps per rev
- motors->configStepper(200);
-
- // set for half a rotation
- motors->setStepperSteps(100);
-
- // let it go - clockwise rotation, 10 RPM speed
- motors->enableStepper(upm::GroveMD::STEP_DIR_CW, 10);
-
- sleep(3);
-
- // Now do it backwards...
- motors->setStepperSteps(100);
- motors->enableStepper(upm::GroveMD::STEP_DIR_CCW, 10);
-
- // now disable
- motors->disableStepper();
-
- //! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete motors;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovemd.cxx b/peripheral/libupm/examples/c++/grovemd.cxx
deleted file mode 100644
index a5c1015..0000000
--- a/peripheral/libupm/examples/c++/grovemd.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "grovemd.h"
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
- //! [Interesting]
- // Instantiate an I2C Grove Motor Driver on I2C bus 0
-
- upm::GroveMD *motors = new upm::GroveMD(GROVEMD_I2C_BUS,
- GROVEMD_DEFAULT_I2C_ADDR);
-
- // set direction to CW and set speed to 50%
- cout << "Spin M1 and M2 at half speed for 3 seconds" << endl;
- motors->setMotorDirections(upm::GroveMD::DIR_CW, upm::GroveMD::DIR_CW);
- motors->setMotorSpeeds(127, 127);
-
- sleep(3);
- // counter clockwise
- cout << "Reversing M1 and M2 for 3 seconds" << endl;
- motors->setMotorDirections(upm::GroveMD::DIR_CCW, upm::GroveMD::DIR_CCW);
- sleep(3);
-
- //! [Interesting]
-
- cout << "Stopping motors" << endl;
- motors->setMotorSpeeds(0, 0);
-
- cout << "Exiting..." << endl;
-
- delete motors;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovemoisture.cxx b/peripheral/libupm/examples/c++/grovemoisture.cxx
deleted file mode 100644
index 1fee54c..0000000
--- a/peripheral/libupm/examples/c++/grovemoisture.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovemoisture.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Moisture sensor on analog pin A0
- upm::GroveMoisture* moisture = new upm::GroveMoisture(0);
-
- // Values (approximate):
- // 0-300, sensor in air or dry soil
- // 300-600, sensor in humid soil
- // 600+, sensor in wet soil or submerged in water.
- // Read the value every second and print the corresponding moisture level
- while (shouldRun)
- {
- int val = moisture->value();
- cout << "Moisture value: " << val << ", ";
- if (val >= 0 && val < 300)
- cout << "dry";
- else if (val >= 300 && val < 600)
- cout << "moist";
- else
- cout << "wet";
-
- cout << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete moisture;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveo2.cxx b/peripheral/libupm/examples/c++/groveo2.cxx
deleted file mode 100644
index cc1b240..0000000
--- a/peripheral/libupm/examples/c++/groveo2.cxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "groveo2.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the O2 Oxygen Concentration Sensor Module
- // Instantiate a GroveO2 on analog pin A0
- upm::GroveO2 *O2 = new upm::GroveO2(0);
- while (shouldRun)
- {
- cout << "The output voltage is: " << O2->voltageValue() << "mV" << endl;
- usleep(100000);
- }
-
-//! [Interesting]
- cout << "Exiting" << endl;
- delete O2;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groverelay.cxx b/peripheral/libupm/examples/c++/groverelay.cxx
deleted file mode 100644
index 4366dd6..0000000
--- a/peripheral/libupm/examples/c++/groverelay.cxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "grove.h"
-
-int
-main(int argc, char **argv)
-{
- // This example uses GPIO 0
-//! [Interesting]
-
- // Create the relay switch object using GPIO pin 0
- upm::GroveRelay* relay = new upm::GroveRelay(0);
-
- // Close and then open the relay switch 3 times,
- // waiting one second each time. The LED on the relay switch
- // will light up when the switch is on (closed).
- // The switch will also make a noise between transitions.
- for ( int i = 0; i < 3; i++ ) {
- relay->on();
- if ( relay->isOn() )
- std::cout << relay->name() << " is on" << std::endl;
- sleep(1);
- relay->off();
- if ( relay->isOff() )
- std::cout << relay->name() << " is off" << std::endl;
- sleep(1);
- }
-
- // Delete the relay switch object
- delete relay;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groverotary.cxx b/peripheral/libupm/examples/c++/groverotary.cxx
deleted file mode 100644
index 4139242..0000000
--- a/peripheral/libupm/examples/c++/groverotary.cxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <iomanip>
-#include "grove.h"
-
-using namespace std;
-
-int main ()
-{
-//! [Interesting]
- // Instantiate a rotary sensor on analog pin A0
- upm::GroveRotary* knob = new upm::GroveRotary(0);
-
- // Print sensor name to confirm it initialized properly
- cout << knob->name() << endl;
-
- while(true) {
- float abs_value = knob->abs_value(); // Absolute raw value
- float abs_deg = knob->abs_deg(); // Absolute degrees
- float abs_rad = knob->abs_rad(); // Absolute radians
- float rel_value = knob->rel_value(); // Relative raw value
- float rel_deg = knob->rel_deg(); // Relative degrees
- float rel_rad = knob->rel_rad(); // Relative radians
-
- fprintf(stdout, "Absolute: %4d raw %5.2f deg = %3.2f rad Relative: %4d raw %5.2f deg %3.2f rad\n",
- (int16_t)abs_value, abs_deg, abs_rad, (int16_t)rel_value, rel_deg, rel_rad);
-
- usleep(2500000); // Sleep for 2.5s
- }
-//! [Interesting]
- delete knob;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovescam.cxx b/peripheral/libupm/examples/c++/grovescam.cxx
deleted file mode 100644
index 6edd85d..0000000
--- a/peripheral/libupm/examples/c++/grovescam.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdio.h>
-#include "grovescam.h"
-
-using namespace std;
-using namespace upm;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
-
- // Instantiate a Grove Serial Camera on UART 0
- upm::GROVESCAM* camera = new upm::GROVESCAM(0);
-
- // make sure port is initialized properly. 115200 baud is the default.
- if (!camera->setupTty())
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- if (camera->init())
- cout << "Initialized..." << endl;
- else
- cout << "init() failed" << endl;
-
- if (camera->preCapture())
- cout << "preCapture succeeded..." << endl;
- else
- cout << "preCapture failed." << endl;
-
- if (camera->doCapture())
- cout << "doCapture succeeded..." << endl;
- else
- cout << "doCapture failed." << endl;
-
- cout << "Image size is " << camera->getImageSize() << " bytes" << endl;
-
- if (camera->getImageSize() > 0)
- {
- cout << "Storing image.jpg..." << endl;
- if (camera->storeImage("image.jpg"))
- cout << "storeImage succeeded..." << endl;
- else
- cout << "storeImage failed." << endl;
- }
-//! [Interesting]
-
- delete camera;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveslide.cxx b/peripheral/libupm/examples/c++/groveslide.cxx
deleted file mode 100644
index 42e975a..0000000
--- a/peripheral/libupm/examples/c++/groveslide.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include <unistd.h>
-#include <iostream>
-#include <iomanip>
-#include "grove.h"
-
-using namespace std;
-
-int main ()
-{
-//! [Interesting]
- upm::GroveSlide* slide = new upm::GroveSlide(0); // Instantiate new grove slide potentiometer on analog pin A0
-
- cout << slide->name() << endl;
-
- while(true) {
- float adc_value = slide->raw_value(); // Read raw value
- float volts = slide->voltage_value(); // Read voltage, board reference set at 5.0V
- fprintf(stdout, "%4d = %.2f V\n", (uint16_t)adc_value, volts);
-
- usleep(2500000); // Sleep for 2.5s
- }
-//! [Interesting]
- delete slide;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovespeaker.cxx b/peripheral/libupm/examples/c++/grovespeaker.cxx
deleted file mode 100644
index 97d6518..0000000
--- a/peripheral/libupm/examples/c++/grovespeaker.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovespeaker.h"
-
-using namespace std;
-
-int main ()
-{
-//! [Interesting]
- // Instantiate a Grove Speaker on digital pin D2
- upm::GroveSpeaker* speaker = new upm::GroveSpeaker(2);
-
- // Play all 7 of the lowest notes
- speaker->playAll();
-
- // Play a medium C-sharp
- speaker->playSound('c', true, "med");
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete speaker;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovetemp.cxx b/peripheral/libupm/examples/c++/grovetemp.cxx
deleted file mode 100644
index 73de9c7..0000000
--- a/peripheral/libupm/examples/c++/grovetemp.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <iomanip>
-#include "grove.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
-
- // Create the temperature sensor object using AIO pin 0
- upm::GroveTemp* temp = new upm::GroveTemp(0);
- std::cout << temp->name() << std::endl;
-
- // Read the temperature ten times, printing both the Celsius and
- // equivalent Fahrenheit temperature, waiting one second between readings
- for (int i=0; i < 10; i++) {
- int celsius = temp->value();
- int fahrenheit = (int) (celsius * 9.0/5.0 + 32.0);
- printf("%d degrees Celsius, or %d degrees Fahrenheit\n",
- celsius, fahrenheit);
- sleep(1);
- }
-
- // Delete the temperature sensor object
- delete temp;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/groveultrasonic.cxx b/peripheral/libupm/examples/c++/groveultrasonic.cxx
deleted file mode 100644
index e054c4c..0000000
--- a/peripheral/libupm/examples/c++/groveultrasonic.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Jun Kato <i@junkato.jp>
- * Copyright (c) 2015 Jun Kato.
- *
- * Thanks to Seeed Studio for a working arduino sketch
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "groveultrasonic.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-upm::GroveUltraSonic *sonar = NULL;
-bool running = true;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- running = false;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
- // upm::GroveUltraSonic *sonar = NULL;
- sonar = new upm::GroveUltraSonic(2);
- while(running) {
- int width = sonar->getDistance();
- printf("Echo width = %d\n", width);
- printf("Distance inches = %f.2\n\n", width/148.0);
- sleep(3);
- }
-//! [Interesting]
- printf("exiting application\n");
- delete sonar;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovevdiv.cxx b/peripheral/libupm/examples/c++/grovevdiv.cxx
deleted file mode 100644
index 40be66c..0000000
--- a/peripheral/libupm/examples/c++/grovevdiv.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovevdiv.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Voltage Divider sensor on analog pin A0
- upm::GroveVDiv* vDiv = new upm::GroveVDiv(0);
-
- // collect data and output measured voltage according to the setting
- // of the scaling switch (3 or 10)
- while (shouldRun)
- {
- unsigned int val = vDiv->value(100);
- float gain3val = vDiv->computedValue(3, val);
- float gain10val = vDiv->computedValue(10, val);
- cout << "ADC value: " << val << " Gain 3: " << gain3val
- << "v Gain 10: " << gain10val << "v" << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete vDiv;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovewater.cxx b/peripheral/libupm/examples/c++/grovewater.cxx
deleted file mode 100644
index 51bfacb..0000000
--- a/peripheral/libupm/examples/c++/grovewater.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovewater.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Water sensor on digital pin D2
- upm::GroveWater* water = new upm::GroveWater(2);
-
- while (shouldRun)
- {
- bool val = water->isWet();
- if (val)
- cout << "Sensor is wet." << endl;
- else
- cout << "Sensor is dry." << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete water;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/grovewfs.cxx b/peripheral/libupm/examples/c++/grovewfs.cxx
deleted file mode 100644
index ea819ae..0000000
--- a/peripheral/libupm/examples/c++/grovewfs.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "grovewfs.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Water Flow Sensor on digital pin D2
- upm::GroveWFS* flow = new upm::GroveWFS(2);
-
- // set the flow counter to 0 and start counting
- flow->clearFlowCounter();
- flow->startFlowCounter();
-
- while (shouldRun)
- {
- // we grab these (,illis and flowCount) just for display
- // purposes in this example
- uint32_t millis = flow->getMillis();
- uint32_t flowCount = flow->flowCounter();
-
- float fr = flow->flowRate();
-
- // output milliseconds passed, flow count, and computed flow rate
- cout << "Millis: " << millis << " Flow Count: " << flowCount;
- cout << " Flow Rate: " << fr << " LPM" << endl;
-
- // best to gather data for at least one second for reasonable
- // results.
- sleep(2);
- }
-
- flow->stopFlowCounter();
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete flow;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/guvas12d.cxx b/peripheral/libupm/examples/c++/guvas12d.cxx
deleted file mode 100644
index 3351741..0000000
--- a/peripheral/libupm/examples/c++/guvas12d.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "guvas12d.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-// analog voltage, usually 3.3 or 5.0
-#define GUVAS12D_AREF 5.0
-#define SAMPLES_PER_QUERY 1024
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the Grove UV Sensor module.
- // It has a sensing range from between 200-400nm. It's strongest
- // response is around 320-360nm.
-
- // Instantiate a GUVAS12D on analog pin A0
- upm::GUVAS12D *volts = new upm::GUVAS12D(0);
-
- // The higher the voltage the more intense the UV radiation.
-
- while (shouldRun)
- {
- cout << "AREF: " << GUVAS12D_AREF
- << ", Voltage value (higher means more UV): "
- << volts->value(GUVAS12D_AREF, SAMPLES_PER_QUERY) << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete volts;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/h3lis331dl.cxx b/peripheral/libupm/examples/c++/h3lis331dl.cxx
deleted file mode 100644
index d4a04ca..0000000
--- a/peripheral/libupm/examples/c++/h3lis331dl.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "h3lis331dl.h"
-
-using namespace std;
-using namespace upm;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an H3LIS331DL on I2C bus 0
-
- upm::H3LIS331DL *accel = new upm::H3LIS331DL(H3LIS331DL_I2C_BUS,
- H3LIS331DL_DEFAULT_I2C_ADDR);
-
- // Initialize the device with default values
- accel->init();
-
- while (shouldRun)
- {
- int x, y, z;
- float ax, ay, az;
-
- accel->update();
-
- accel->getRawXYZ(&x, &y, &z);
- accel->getAcceleration(&ax, &ay, &az);
-
- cout << "Raw: X = " << x << " Y = " << y << " Z = " << z << endl;
-
- cout << "Acceleration: AX = " << ax << " AY = " << ay << " AZ = " << az
- << endl;
-
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete accel;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hcsr04.cxx b/peripheral/libupm/examples/c++/hcsr04.cxx
deleted file mode 100644
index c0a2725..0000000
--- a/peripheral/libupm/examples/c++/hcsr04.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "hcsr04.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-upm::HCSR04 *sonar = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- sonar->m_doWork = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- sonar = new upm::HCSR04(5, 6);
- signal(SIGINT, sig_handler);
-
- sleep(1);
-
- for(;;){
- std::cout << "get distance" << std::endl;
- double distance = sonar->getDistance(CM);
- std::cout << "distance " << distance << std::endl;
- sleep(5);
- }
-
- delete sonar;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/hdxxvxta.cxx b/peripheral/libupm/examples/c++/hdxxvxta.cxx
deleted file mode 100644
index 2a555f3..0000000
--- a/peripheral/libupm/examples/c++/hdxxvxta.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "hdxxvxta.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- cout << "Initializing..." << endl;
-
- // Instantiate an HDXXVXTA instance, using A1 for humidity and A0
- // for temperature
- upm::HDXXVXTA *sensor = new upm::HDXXVXTA(1, 0);
-
- // update and print available values every second
- while (shouldRun)
- {
- // update our values from the sensor
- sensor->update();
-
- // we show both C and F for temperature
- cout << "Temperature: " << sensor->getTemperature()
- << " C / " << sensor->getTemperature(true) << " F"
- << endl;
-
- cout << "Humidity: " << sensor->getHumidity()
- << " %" << endl;
-
- cout << endl;
-
- sleep(1);
- }
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hm11.cxx b/peripheral/libupm/examples/c++/hm11.cxx
deleted file mode 100644
index e759804..0000000
--- a/peripheral/libupm/examples/c++/hm11.cxx
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdio.h>
-#include "hm11.h"
-
-using namespace std;
-using namespace upm;
-
-void printUsage(char *progname)
-{
- cout << "Usage: " << progname << " [AT command]" << endl;
- cout << endl;
-
- cout << "If an argument is supplied on the command line, that argument is"
- << endl;
- cout << "sent to the module and the response is printed out." << endl;
- cout << endl;
- cout << "If no argument is used, then the address and PIN of the module"
- << endl;
- cout << "are queried and the results printed out." << endl;
- cout << endl;
- cout << endl;
-}
-
-// simple helper function to send a command and wait for a response
-void sendCommand(upm::HM11* ble, char *cmd)
-{
- char buffer[BUFSIZ];
- ble->writeData(cmd, strlen(cmd));
-
- // wait up to 1 second
- if (ble->dataAvailable(1000))
- {
- memset(buffer, 0, BUFSIZ);
-
- ble->readData(buffer, BUFSIZ - 1);
- cout << "Returned: " << buffer << endl;
- }
- else
- {
- cerr << "Timed out waiting for response" << endl;
- }
-}
-
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- char buffer[BUFSIZ];
- // Instantiate a HM11 BLE Module on UART 0
-
- upm::HM11* ble = new upm::HM11(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!ble->setupTty(B9600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- printUsage(argv[0]);
-
- if (argc > 1)
- {
- cout << "Sending command line argument (" << argv[1] << ")..." << endl;
- sendCommand(ble, argv[1]);
- }
- else
- {
- // query the module address
- char addr[] = "AT+ADDR?";
- cout << "Querying module address (" << addr << ")..." << endl;
- sendCommand(ble, addr);
-
- sleep(1);
-
- // query the module address
- char pin[] = "AT+PASS?";
- cout << "Querying module PIN (" << pin << ")..." << endl;
- sendCommand(ble, pin);
-
- // Other potentially useful commands are:
- //
- // AT+VERS? - query module version
- // AT+ROLE0 - set as slave
- // AT+ROLE1 - set as master
- // AT+CLEAR - clear all previous settings
- // AT+RESET - restart the device
- //
- // A comprehensive list is available from the datasheet at:
- // http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
- }
-
-//! [Interesting]
-
- delete ble;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hmc5883l.cxx b/peripheral/libupm/examples/c++/hmc5883l.cxx
deleted file mode 100644
index dec08ce..0000000
--- a/peripheral/libupm/examples/c++/hmc5883l.cxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Contributions: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include "hmc5883l.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate on I2C
- upm::Hmc5883l* compass = new upm::Hmc5883l(0);
- int16_t *pos;
-
- compass->set_declination(0.2749); // Set your declination from true north in radians
-
- // Print out the coordinates, heading, and direction every second
- while(true){
- compass->update(); // Update the coordinates
- pos = compass->coordinates();
- fprintf(stdout, "coor: %5d %5d %5d ", pos[0], pos[1], pos[2]);
- fprintf(stdout, "heading: %5.2f direction: %3.2f\n", compass->heading(), compass->direction());
- sleep(1);
- }
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hmtrp.cxx b/peripheral/libupm/examples/c++/hmtrp.cxx
deleted file mode 100644
index 3d58ba9..0000000
--- a/peripheral/libupm/examples/c++/hmtrp.cxx
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <string.h>
-#include <iostream>
-#include <signal.h>
-#include "hmtrp.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-void printUsage()
-{
- cout << "Usage:" << endl;
- cout << "Pass a commandline argument (any argument) to this program"
- << endl;
- cout << "to query the radio configuration and output it. NOTE: the"
- << endl;
- cout << "radio must be in CONFIG mode for this to work."
- << endl;
- cout << endl;
- cout << "Running this program without arguments will simply transmit"
- << endl;
- cout << "'Hello World!' every second, and output any data received from"
- << endl;
- cout << "another radio."
- << endl;
- cout << endl;
-}
-
-const size_t bufferLength = 256;
-
-int main (int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a HMTRP radio device on uart 0
-
- upm::HMTRP* radio = new upm::HMTRP(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!radio->setupTty(B9600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- printUsage();
-
- // By default, this radio simply transmits data sent via writeData()
- // and reads any available data via readData().
-
- // It can be placed into a configuration mode by grounding the
- // CONFIG pin on the module. When this is done, the various
- // configuration query and config methods can be used. In this
- // example, by default, we just read any data available fom the
- // device, and periodically transmit "Hello World".
-
- // If any argument was specified on the command line, do a simple
- // configuration query and output the results. The radio must be in
- // CONFIG mode for this to work.
-
- if (argc > 1)
- {
- // config mode
- uint32_t freq;
- uint32_t dataRate;
- uint16_t rxBandwidth;
- uint8_t modulation;
- uint8_t txPower;
- uint32_t uartBaud;
-
- if (radio->getConfig(&freq, &dataRate, &rxBandwidth, &modulation,
- &txPower, &uartBaud))
- {
- cout << "Radio configuration:" << endl;
- cout << "freq: " << freq << " dataRate: " << dataRate
- << " rxBandwidth: " << rxBandwidth << "Khz" << endl;
-
- cout << "modulation: " << int(modulation) << "Khz txPower: "
- << int(txPower) << " uartBaud: " << uartBaud << endl;
- }
- else
- {
- cerr << "getConfig() failed. Make sure the radio is in "
- << "CONFIG mode." << endl;
- }
- }
- else
- {
- // normal read/write mode
- char radioBuffer[bufferLength];
- int counter = 0;
- cout << "Running in normal read/write mode." << endl;
-
- while (shouldRun)
- {
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (radio->dataAvailable())
- {
- memset(radioBuffer, 0, bufferLength);
- int rv = radio->readData(radioBuffer, bufferLength - 1);
-
- if (rv > 0)
- cout << "Received: " << radioBuffer << endl;
-
- if (rv < 0) // some sort of read error occured
- {
- cerr << "Port read error." << endl;
- break;
- }
-
- continue;
- }
-
- usleep(100000); // 100ms
- counter++;
- // every second, transmit "Hello World"
- if (counter > 10)
- {
- static const char *hello = "Hello World!";
- cout << "Transmitting hello world..." << endl;
- radio->writeData((char *)hello, strlen(hello) + 1);
- counter = 0;
- }
- }
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete radio;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hp20x.cxx b/peripheral/libupm/examples/c++/hp20x.cxx
deleted file mode 100644
index 119a449..0000000
--- a/peripheral/libupm/examples/c++/hp20x.cxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "hp20x.h"
-
-using namespace std;
-using namespace upm;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an HP20X on default I2C bus and address
-
- upm::HP20X *bar = new upm::HP20X();
-
- // Initialize the device with default values
- bar->init();
-
- // Output data every second until interrupted
- while (shouldRun)
- {
- printf("Temperature: %f Celcius\n", bar->getTemperature());
- printf("Pressure: %f Millibars\n", bar->getPressure());
- printf("Altitude: %f Meters\n", bar->getAltitude());
-
- printf("\n");
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete bar;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ht9170.cxx b/peripheral/libupm/examples/c++/ht9170.cxx
deleted file mode 100644
index 1be72b6..0000000
--- a/peripheral/libupm/examples/c++/ht9170.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "ht9170.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main ()
-{
- signal(SIGINT, sig_handler);
- //! [Interesting]
-
- // Instantiate a DTMF decoder
- upm::HT9170* dtmf = new upm::HT9170(12, 11, 10, 9, 8);
-
- // Now we just spin in a loop, sleeping every 100ms, checking to see
- // if a digit is available. If so, we decode and print the digit,
- // and continue looping.
-
- while(shouldRun)
- {
- if (dtmf->digitReady())
- {
- cout << "Got DTMF code: " << dtmf->decodeDigit() << endl;
- // now spin until digitReady() goes false again
- while (dtmf->digitReady())
- ;
- }
-
- usleep(100000);
- }
-
- //! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete dtmf;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/htu21d.cxx b/peripheral/libupm/examples/c++/htu21d.cxx
deleted file mode 100644
index 63d6fdf..0000000
--- a/peripheral/libupm/examples/c++/htu21d.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "htu21d.h"
-
-volatile int doWork = 0;
-
-upm::HTU21D *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- printf("\nCtrl-C received.\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- // Register signal handler
- signal(SIGINT, sig_handler);
-
- //! [Interesting]
- float humidity = 0.0;
- float temperature = 0.0;
- float compRH = 0.0;
-
- sensor = new upm::HTU21D(0, HTU21D_I2C_ADDRESS);
-
- sensor->testSensor();
-
- while (!doWork) {
- compRH = sensor->getCompRH(true);
- humidity = sensor->getHumidity(false);
- temperature = sensor->getTemperature(false);
-
- std::cout << "humidity value = " <<
- humidity <<
- ", temperature value = " <<
- temperature <<
- ", compensated RH value = " <<
- compRH << std::endl;
- usleep (500000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hwxpxx.cxx b/peripheral/libupm/examples/c++/hwxpxx.cxx
deleted file mode 100644
index 1cfdf54..0000000
--- a/peripheral/libupm/examples/c++/hwxpxx.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "hwxpxx.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- string defaultDev = "/dev/ttyUSB0";
-
- // if an argument was specified, use it as the device instead
- if (argc > 1)
- defaultDev = string(argv[1]);
-
- cout << "Using device " << defaultDev << endl;
- cout << "Initializing..." << endl;
-
- // Instantiate an HWXPXX instance, using MODBUS slave address 3, and
- // default comm parameters (19200, 8, N, 2)
- upm::HWXPXX *sensor = new upm::HWXPXX(defaultDev, 3);
-
- // output the Slave ID (manufacturer, model, serno)
- cout << "Slave ID: " << sensor->getSlaveID() << endl;
-
- // stored temperature and humidity offsets
- cout << "Temperature Offset: " << sensor->getTemperatureOffset()
- << endl;
- cout << "Humidity Offset: " << sensor->getHumidityOffset()
- << endl;
-
- cout << endl;
-
- // update and print available values every second
- while (shouldRun)
- {
- // update our values from the sensor
- sensor->update();
-
- // we show both C and F for temperature
- cout << "Temperature: " << sensor->getTemperature()
- << " C / " << sensor->getTemperature(true) << " F"
- << endl;
-
- cout << "Humidity: " << sensor->getHumidity()
- << " %" << endl;
-
- cout << "Slider: " << sensor->getSlider() << " %" << endl;
-
- cout << "Override Switch Status: " << sensor->getOverrideSwitchStatus()
- << endl;
-
- cout << endl;
-
- sleep(1);
- }
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/hx711.cxx b/peripheral/libupm/examples/c++/hx711.cxx
deleted file mode 100644
index 531734b..0000000
--- a/peripheral/libupm/examples/c++/hx711.cxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-*
-* Author: Rafael da Mata Neri <rafael.neri@gmail.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to
-* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-* the Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-//! [Interesting]
-#include "hx711.h"
-
-int
-main(int argc, char **argv)
-{
- upm::HX711 *scale = new upm::HX711(3, 2);
-
- // 2837: value obtained via calibration
- scale->setScale(2837);
- scale->tare();
- std::cout << scale->getUnits() << std::endl;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/ili9341.cxx b/peripheral/libupm/examples/c++/ili9341.cxx
deleted file mode 100644
index 8fe397a..0000000
--- a/peripheral/libupm/examples/c++/ili9341.cxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Author: Shawn Hymel
- * Copyright (c) 2016 SparkFun Electronics
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-
-#include "ili9341.h"
-
-int main(int argc, char **argv) {
-//! [Interesting]
-
- // Pins (Edison)
- // CS_LCD GP44 (MRAA 31)
- // CS_SD GP43 (MRAA 38) unused
- // DC GP12 (MRAA 20)
- // RESEST GP13 (MRAA 14)
- upm::ILI9341 * lcd = new upm::ILI9341(31, 38, 20, 14);
-
- // Fill the screen with a solid color
- lcd->fillScreen(lcd->color565(0, 40, 16));
-
- // Draw some shapes
- lcd->drawFastVLine(10, 10, 100, ILI9341_RED);
- lcd->drawFastHLine(20, 10, 50, ILI9341_CYAN);
- lcd->drawLine(160, 30, 200, 60, ILI9341_GREEN);
- lcd->fillRect(20, 30, 75, 60, ILI9341_ORANGE);
- lcd->drawCircle(70, 50, 20, ILI9341_PURPLE);
- lcd->fillCircle(120, 50, 20, ILI9341_PURPLE);
- lcd->drawTriangle(50, 100, 10, 140, 90, 140, ILI9341_YELLOW);
- lcd->fillTriangle(150, 100, 110, 140, 190, 140, ILI9341_YELLOW);
- lcd->drawRoundRect(20, 150, 50, 30, 10, ILI9341_RED);
- lcd->drawRoundRect(130, 150, 50, 30, 10, ILI9341_RED);
- lcd->fillRoundRect(75, 150, 50, 30, 10, ILI9341_RED);
-
- // Write some text
- lcd->setCursor(0, 200);
- lcd->setTextColor(ILI9341_LIGHTGREY);
- lcd->setTextWrap(true);
- lcd->setTextSize(1);
- lcd->print("Text 1\n");
- lcd->setTextSize(2);
- lcd->print("Text 2\n");
- lcd->setTextSize(3);
- lcd->print("Text 3\n");
- lcd->setTextSize(4);
- lcd->print("Text 4\n");
-
- // Test screen rotation
- for(int r = 0; r < 4; r++) {
- lcd->setRotation(r);
- lcd->fillRect(0, 0, 5, 5, ILI9341_WHITE);
- sleep(1);
- }
-
- // Invert colors, wait, then revert back
- lcd->invertDisplay(true);
- sleep(2);
- lcd->invertDisplay(false);
-
- // Don't forget to free up that memory!
- delete lcd;
-//! [Interesting]
- return 0;
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/c++/ina132.cxx b/peripheral/libupm/examples/c++/ina132.cxx
deleted file mode 100644
index 0c78630..0000000
--- a/peripheral/libupm/examples/c++/ina132.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "ina132.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the INA132 Differential Amplifier Sensor module.
-
- // Instantiate an INA132 on analog pin A0
- upm::INA132 *amplifier = new upm::INA132(0);
-
- while (shouldRun)
- {
- cout << amplifier->value() << endl;
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete amplifier;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/isd1820.cxx b/peripheral/libupm/examples/c++/isd1820.cxx
deleted file mode 100644
index 3246808..0000000
--- a/peripheral/libupm/examples/c++/isd1820.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "isd1820.h"
-
-using namespace std;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a ISD1820 on digital pins 2 (play) and 3 (record)
- // This example was tested on the Grove Recorder.
-
- upm::ISD1820* recorder = new upm::ISD1820(2, 3);
-
- // if an argument was specified (any argument), go into record mode,
- // else playback a previously recorded sample
-
- cout << "Supply any argument to the command line to record." << endl;
- cout << "Running this example without arguments will play back any " << endl;
- cout << "previously recorded sound." << endl;
- cout << "There is approximately 10 seconds of recording time." << endl;
-
- cout << endl;
-
- bool doRecord = false;
-
- if (argc > 1)
- doRecord = true;
-
- // depending on what was selected, do it, and sleep for 15 seconds
-
- if (doRecord)
- recorder->record(true);
- else
- recorder->play(true);
-
- // There are about 10 seconds of recording/playback time, so we will
- // sleep for a little extra time.
- cout << "Sleeping for 15 seconds..." << endl;
- sleep(15);
-
- // now, turn off whatever we were doing.
-
- if (doRecord)
- recorder->record(false);
- else
- recorder->play(false);
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete recorder;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/itg3200.cxx b/peripheral/libupm/examples/c++/itg3200.cxx
deleted file mode 100644
index a1bf8af..0000000
--- a/peripheral/libupm/examples/c++/itg3200.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include "itg3200.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- int16_t *rot;
- float *ang;
-
- // Note: Sensor not supported on Intel Edison with Arduino breakout
- upm::Itg3200* gyro = new upm::Itg3200(0);
-
- while(true){
- gyro->update(); // Update the data
- rot = gyro->getRawValues(); // Read raw sensor data
- ang = gyro->getRotation(); // Read rotational speed (deg/sec)
- fprintf(stdout, "Raw: %6d %6d %6d\n", rot[0], rot[1], rot[2]);
- fprintf(stdout, "AngX: %5.2f\n", ang[0]);
- fprintf(stdout, "AngY: %5.2f\n", ang[1]);
- fprintf(stdout, "AngZ: %5.2f\n", ang[2]);
- fprintf(stdout, "Temp: %5.2f Raw: %6d\n", gyro->getTemperature(), gyro->getRawTemp());
- sleep(1);
- }
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/jhd1313m1-lcd.cxx b/peripheral/libupm/examples/c++/jhd1313m1-lcd.cxx
deleted file mode 100644
index ca2f155..0000000
--- a/peripheral/libupm/examples/c++/jhd1313m1-lcd.cxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "jhd1313m1.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- // 0x62 RGB_ADDRESS, 0x3E LCD_ADDRESS
- upm::Jhd1313m1 *lcd = new upm::Jhd1313m1(0, 0x3E, 0x62);
- lcd->setCursor(0,0);
- lcd->write("Hello World");
- lcd->setCursor(1,2);
- lcd->write("Hello World");
-
- printf("Sleeping for 5 seconds\n");
- sleep(5);
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/joystick12.cxx b/peripheral/libupm/examples/c++/joystick12.cxx
deleted file mode 100644
index 408ca2a..0000000
--- a/peripheral/libupm/examples/c++/joystick12.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Alexander Komarov <alexander.komarov@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "joystick12.h"
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-upm::Joystick12 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- // Instantiate a joystick on analog pins A0 and A1
- sensor = new upm::Joystick12(0,1);
- signal(SIGINT, sig_handler);
-
- // Print the X and Y input values every second
- while (!is_running) {
- float x = sensor->getXInput();
- float y = sensor->getYInput();
- std::cout << "Driving X:" << x << ": and Y:" << y << std::endl;
- sleep(1);
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/kxcjk1013.cxx b/peripheral/libupm/examples/c++/kxcjk1013.cxx
deleted file mode 100644
index 3732dbd..0000000
--- a/peripheral/libupm/examples/c++/kxcjk1013.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Lay, Kuan Loon <kuan.loon.lay@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "kxcjk1013.h"
-
-using namespace std;
-
-int shouldRun = true;
-upm::KXCJK1013* accelerometer;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-void
-data_callback(char* data)
-{
- float x, y, z;
- accelerometer->extract3Axis(data, &x, &y, &z);
- printf("%.1f %.1f %.1f\n", x, y, z);
- // usleep(100);
-}
-
-int
-main()
-{
- signal(SIGINT, sig_handler);
- //! [Interesting]
- // Instantiate a KXCJK1013 Accelerometer Sensor on iio device 0
- accelerometer = new upm::KXCJK1013(0);
- accelerometer->setScale(0.019163);
- accelerometer->setSamplingFrequency(25.0);
- accelerometer->enable3AxisChannel();
- accelerometer->installISR(data_callback, NULL);
- accelerometer->enableBuffer(16);
-
- while (shouldRun) {
- sleep(1);
- }
- accelerometer->disableBuffer();
-
- //! [Interesting]
- cout << "Exiting" << endl;
-
- delete accelerometer;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/l298-stepper.cxx b/peripheral/libupm/examples/c++/l298-stepper.cxx
deleted file mode 100644
index 8fe2b91..0000000
--- a/peripheral/libupm/examples/c++/l298-stepper.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "l298.h"
-
-using namespace std;
-
-int main ()
-{
- //! [Interesting]
-
- // Instantiate a Stepper motor on a L298 Dual H-Bridge.
-
- // This was tested with the NEMA-17 12V, 350mA, with 200 steps per rev.
- upm::L298* l298 = new upm::L298(200, 3, 4, 7, 8, 9);
-
- l298->setSpeed(10); // 10 RPMs
- l298->setDirection(upm::L298::DIR_CW);
- l298->enable(true);
- cout << "Rotating 1 full revolution at 10 RPM speed." << endl;
- // move 200 steps, a full rev
- l298->stepperSteps(200);
- cout << "Sleeping for 2 seconds..." << endl;
- sleep(2);
- cout << "Rotating 1/2 revolution in opposite direction at 10 RPM speed."
- << endl;
- l298->setDirection(upm::L298::DIR_CCW);
- l298->stepperSteps(100);
- // release
- l298->enable(false);
-
- //! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete l298;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/l298.cxx b/peripheral/libupm/examples/c++/l298.cxx
deleted file mode 100644
index 8e360b2..0000000
--- a/peripheral/libupm/examples/c++/l298.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "l298.h"
-
-using namespace std;
-
-int main ()
-{
- //! [Interesting]
-
- // Instantiate one of the 2 possible DC motors on a L298 Dual
- // H-Bridge. For controlling a stepper motor, see the l298-stepper
- // example.
- upm::L298* l298 = new upm::L298(3, 4, 7);
-
- cout << "Starting motor at 50% for 3 seconds..." << endl;
- l298->setSpeed(50);
- l298->setDirection(upm::L298::DIR_CW);
- l298->enable(true);
-
- sleep(3);
-
- cout << "Reversing direction..." << endl;
- l298->setDirection(upm::L298::DIR_NONE); // fast stop
- l298->setDirection(upm::L298::DIR_CCW);
- sleep(3);
-
- l298->setSpeed(0);
- l298->enable(false);
-
- //! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete l298;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/lcm1602-i2c.cxx b/peripheral/libupm/examples/c++/lcm1602-i2c.cxx
deleted file mode 100644
index f405f96..0000000
--- a/peripheral/libupm/examples/c++/lcm1602-i2c.cxx
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "lcm1602.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- upm::Lcm1602* lcd = new upm::Lcm1602(0, 0x27);
- lcd->setCursor(0,0);
- lcd->write("Hello World");
-//! [Interesting]
- sleep(3);
- lcd->setCursor(1,2);
- lcd->write("Hello World");
- sleep(3);
- lcd->setCursor(2,4);
- lcd->write("Hello World");
- sleep(3);
- lcd->setCursor(3,6);
- lcd->write("Hello World");
- sleep(3);
- delete lcd;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/lcm1602-parallel.cxx b/peripheral/libupm/examples/c++/lcm1602-parallel.cxx
deleted file mode 100644
index 642c6af..0000000
--- a/peripheral/libupm/examples/c++/lcm1602-parallel.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Sergey Kiselev <sergey.kiselev@intel.com>
- * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 - 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <lcm1602.h>
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- // LCD connection:
- // LCD RS pin to digital pin 8
- // LCD Enable pin to digital pin 13
- // LCD D4 pin to digital pin 2
- // LCD D5 pin to digital pin 3
- // LCD D6 pin to digital pin 4
- // LCD D7 pin to digital pin 5
- // LCD R/W pin to ground
- // 10K trimmer potentiometer:
- // ends to +5V and ground
- // wiper to LCD VO pin (pin 3)
- upm::Lcm1602 *lcd = new upm::Lcm1602(8, 13, 2, 3, 4, 5, 20, 2);
- lcd->setCursor(0,0);
- lcd->write("Hello World");
- lcd->setCursor(1,2);
- lcd->write("Hello World");
-
- printf("Sleeping for 5 seconds\n");
- sleep(5);
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ldt0028.cxx b/peripheral/libupm/examples/c++/ldt0028.cxx
deleted file mode 100644
index 8d9c8b7..0000000
--- a/peripheral/libupm/examples/c++/ldt0028.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <iomanip>
-#include <cmath>
-#include "ldt0028.h"
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- const int NUMBER_OF_SECONDS = 10;
- const int MICROSECONDS_PER_SECOND = 1000000;
- const int SAMPLES_PER_SECOND = 50;
- const int THRESHOLD = 100;
-
- // Create the LDT0-028 Piezo Vibration Sensor object using AIO pin 0
- upm::LDT0028* sensor = new upm::LDT0028(0);
-
- // Read the signal every 20 milliseconds for 10 seconds
- std::cout << "For the next " << NUMBER_OF_SECONDS << " seconds, "
- << SAMPLES_PER_SECOND << " samples will be taken every second."
- << std::endl << std::endl;
- uint16_t* buffer = new uint16_t[NUMBER_OF_SECONDS * SAMPLES_PER_SECOND];
- for (int i=0; i < NUMBER_OF_SECONDS * SAMPLES_PER_SECOND; i++) {
- buffer[i] = (uint16_t) sensor->getSample();
- usleep(MICROSECONDS_PER_SECOND / SAMPLES_PER_SECOND);
- }
-
- // Print the number of times the reading was greater than the threshold
- int count = 0;
- for (int i=0; i < NUMBER_OF_SECONDS * SAMPLES_PER_SECOND; i++) {
- if (buffer[i] > THRESHOLD) {
- count++;
- }
- }
- std::cout << sensor->name() << " exceeded the threshold value of " <<
- THRESHOLD << " a total of " << count << " times," << std::endl
- << "out of a total of " << NUMBER_OF_SECONDS*SAMPLES_PER_SECOND
- << " readings." << std::endl << std::endl;
-
- // Print a graphical representation of the average value sampled
- // each second for the past 10 seconds, using a scale factor of 15
- std::cout << "Now printing a graphical representation of the average reading "
- << std::endl << "each second for the last "
- << NUMBER_OF_SECONDS << " seconds." << std::endl;
- const int SCALE_FACTOR = 15;
- for (int i=0; i < NUMBER_OF_SECONDS; i++) {
- long sum = 0;
- for (int j=0; j < SAMPLES_PER_SECOND; j++) {
- sum += buffer[i*SAMPLES_PER_SECOND + j];
- }
- double average = (double) sum / (double) SAMPLES_PER_SECOND;
- int stars_to_print = (int) round(average / SCALE_FACTOR);
- std::cout << "(" << std::setw(4) << (int) round(average) << ") | ";
- for (int j=0; j<stars_to_print; j++) {
- std::cout << "*";
- }
- std::cout << std::endl;
- }
-
- // Delete the sensor object
- delete sensor;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/lm35.cxx b/peripheral/libupm/examples/c++/lm35.cxx
deleted file mode 100644
index 8930940..0000000
--- a/peripheral/libupm/examples/c++/lm35.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "lm35.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a LM35 on analog pin A0, with a default analog
- // reference voltage of 5.0
- upm::LM35 *sensor = new upm::LM35(0);
-
- // Every half second, sample the sensor and output the temperature
-
- while (shouldRun)
- {
- cout << "Temperature: " << sensor->getTemperature() << " C" << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/lol.cxx b/peripheral/libupm/examples/c++/lol.cxx
deleted file mode 100644
index 9f2943d..0000000
--- a/peripheral/libupm/examples/c++/lol.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Alexander Komarov <alexander.komarov@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "lol.h"
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-upm::LoL *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- sensor = new upm::LoL();
- signal(SIGINT, sig_handler);
-
- unsigned char *buffer;
- //buffer = sensor->getFramebuffer();
- int x = 0, y = 0;
- while (!is_running) {
- sensor->setPixel(x, y, !(sensor->getPixel(x, y)));
- if (++x == 13) { x = 0; y++; }
- if (y == 9) y = 0;
- usleep(10000);
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/loudness.cxx b/peripheral/libupm/examples/c++/loudness.cxx
deleted file mode 100644
index 44e62b0..0000000
--- a/peripheral/libupm/examples/c++/loudness.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "loudness.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-#define LOUDNESS_AREF 5.0
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a Loudness sensor on analog pin A0, with an analog
- // reference voltage of LOUDNESS_AREF
- upm::Loudness *loud = new upm::Loudness(0, LOUDNESS_AREF);
-
- // Every tenth of a second, sample the loudness and output it's
- // corresponding analog voltage.
-
- while (shouldRun)
- {
- cout << "Detected loudness (volts): " << loud->loudness() << endl;
-
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete loud;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/lpd8806.cxx b/peripheral/libupm/examples/c++/lpd8806.cxx
deleted file mode 100644
index 8828f07..0000000
--- a/peripheral/libupm/examples/c++/lpd8806.cxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "lpd8806.h"
-#include <signal.h>
-
-void scanner(uint8_t r, uint8_t g, uint8_t b, uint8_t wait);
-
-int doWork = 0;
-upm::LPD8806 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- sensor = new upm::LPD8806(10, 7);
- usleep (1000000);
-
- sensor->show ();
-
- while (!doWork) {
- // Back-and-forth lights
- scanner(127, 0, 0, 30); // red, slow
- scanner(0, 0, 127, 15); // blue, fast
- usleep (1000000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-
-void scanner(uint8_t r, uint8_t g, uint8_t b, uint8_t wait) {
- int i, j, pos, dir;
-
- pos = 0;
- dir = 1;
-
- for(i=0; i < ((sensor->getStripLength() - 1) * 8); i++) {
- // Draw 5 pixels centered on pos. setPixelColor() will clip
- // any pixels off the ends of the strip, no worries there.
- // we'll make the colors dimmer at the edges for a nice pulse
- // look
- sensor->setPixelColor(pos - 2, r/4, g/4, b/4);
- sensor->setPixelColor(pos - 1, r/2, g/2, b/2);
- sensor->setPixelColor(pos, r, g, b);
- sensor->setPixelColor(pos + 1, r/2, g/2, b/2);
- sensor->setPixelColor(pos + 2, r/4, g/4, b/4);
-
- sensor->show();
- usleep (wait * 1000);
- // If we wanted to be sneaky we could erase just the tail end
- // pixel, but it's much easier just to erase the whole thing
- // and draw a new one next time.
- for(j=-2; j<= 2; j++) {
- sensor->setPixelColor(pos+j, 0,0,0);
- }
- // Bounce off ends of strip
- pos += dir;
- if(pos < 0) {
- pos = 1;
- dir = -dir;
- } else if (pos >= sensor->getStripLength()) {
- pos = sensor->getStripLength() - 2;
- dir = -dir;
- }
- }
-}
diff --git a/peripheral/libupm/examples/c++/lsm303.cxx b/peripheral/libupm/examples/c++/lsm303.cxx
deleted file mode 100644
index f75fd5b..0000000
--- a/peripheral/libupm/examples/c++/lsm303.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-
-//! [Interesting]
-#include "lsm303.h"
-
-int
-main(int argc, char **argv)
-{
- // Instantiate LSM303 compass on I2C
- upm::LSM303 *sensor = new upm::LSM303(0);
-
- // Get the coordinate data
- sensor->getCoordinates();
- int16_t* coor = sensor->getRawCoorData(); // in XYZ order.
- // The sensor returns XZY, but the driver compensates and makes it XYZ
-
- // Print out the X, Y, and Z coordinate data using two different methods
- std::cout << "coor: rX " << (int)coor[0]
- << " - rY " << (int)coor[1]
- << " - rZ " << (int)coor[2]
- << std::endl;
- std::cout << "coor: gX " << sensor->getCoorX()
- << " - gY " << sensor->getCoorY()
- << " - gZ " << sensor->getCoorZ()
- << std::endl;
-
- // Get and print out the heading
- std::cout << "heading: "
- << sensor->getHeading()
- << std::endl;
-
- // Get the acceleration
- sensor->getAcceleration();
- int16_t* accel = sensor->getRawAccelData();
- // Print out the X, Y, and Z acceleration data using two different methods
- std::cout << "acc: rX " << (int)accel[0]
- << " - rY " << (int)accel[1]
- << " - Z " << (int)accel[2]
- << std::endl;
- std::cout << "acc: gX " << sensor->getAccelX()
- << " - gY " << sensor->getAccelY()
- << " - gZ " << sensor->getAccelZ()
- << std::endl;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/lsm9ds0.cxx b/peripheral/libupm/examples/c++/lsm9ds0.cxx
deleted file mode 100644
index 66644a0..0000000
--- a/peripheral/libupm/examples/c++/lsm9ds0.cxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "lsm9ds0.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- // Instantiate an LSM9DS0 using default parameters (bus 1, gyro addr 6b,
- // xm addr 1d)
- upm::LSM9DS0 *sensor = new upm::LSM9DS0();
-
- sensor->init();
-
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getAccelerometer(&x, &y, &z);
- cout << "Accelerometer: ";
- cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
-
- sensor->getGyroscope(&x, &y, &z);
- cout << "Gryoscope: ";
- cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
-
- sensor->getMagnetometer(&x, &y, &z);
- cout << "Magnetometer: ";
- cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
-
- cout << "Temperature: " << sensor->getTemperature() << endl;
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/m24lr64e.cxx b/peripheral/libupm/examples/c++/m24lr64e.cxx
deleted file mode 100644
index 6c3aae0..0000000
--- a/peripheral/libupm/examples/c++/m24lr64e.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "m24lr64e.h"
-
-using namespace std;
-using namespace upm;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an M24LR64E on I2C bus 0
-
- upm::M24LR64E *nfcTag = new upm::M24LR64E(M24LR64E_I2C_BUS);
-
- // This example accesses the device in the 'user' (default) mode,
- // reads the last byte of data in the EEPROM, inverts it, writes
- // it back, and then re-reads it.
-
- // Read the last byte of the EEPROM area
-
- int addr = M24LR64E::EEPROM_I2C_LENGTH - 1;
- printf("Address: %d\n", addr);
- uint8_t byte = nfcTag->readByte(addr);
- printf("Read byte: %02x\n", byte);
-
- // Now change it to it's opposite and write it
- byte = ~byte;
- nfcTag->writeByte(addr, byte);
- printf("Wrote inverted byte: %02x\n", byte);
-
- // Now read it back.
- byte = nfcTag->readByte(addr);
- printf("Read byte: %02x\n", byte);
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete nfcTag;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/max31723.cxx b/peripheral/libupm/examples/c++/max31723.cxx
deleted file mode 100644
index 96082af..0000000
--- a/peripheral/libupm/examples/c++/max31723.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "max31723.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::MAX31723 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- sensor = new upm::MAX31723(7);
- usleep (1000000);
-
- while (!doWork) {
- std::cout << "Temperature " << sensor->getTemperature() << std::endl;
- usleep (1000000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/max31855.cxx b/peripheral/libupm/examples/c++/max31855.cxx
deleted file mode 100644
index 2390d93..0000000
--- a/peripheral/libupm/examples/c++/max31855.cxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-//! [Interesting]
-#include "max31855.h"
-
-int
-main(int argc, char **argv)
-{
- upm::MAX31855 *temp = new upm::MAX31855(0, 8);
-
- std::cout << temp->getTemp() << std::endl;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/max44000.cxx b/peripheral/libupm/examples/c++/max44000.cxx
deleted file mode 100644
index 404f544..0000000
--- a/peripheral/libupm/examples/c++/max44000.cxx
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "max44000.h"
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- upm::MAX44000 *sensor = new upm::MAX44000(0, ADDR);
- std::cout << "proximity value = " << sensor->getAmbient () << std::endl;
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/max5487.cxx b/peripheral/libupm/examples/c++/max5487.cxx
deleted file mode 100644
index 661be05..0000000
--- a/peripheral/libupm/examples/c++/max5487.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "max5487.h"
-#include <signal.h>
-
-upm::MAX5487 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- sensor = new upm::MAX5487(7);
-
- // Power LED UP
- for (int i = 0; i < 255; i++) {
- sensor->setWiperA(i);
- usleep (5000);
- }
-
- // Power LED DOWN
- for (int i = 0; i < 255; i++) {
- sensor->setWiperA(255 - i);
- usleep (5000);
- }
-
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/maxds3231m.cxx b/peripheral/libupm/examples/c++/maxds3231m.cxx
deleted file mode 100644
index e5a6fc1..0000000
--- a/peripheral/libupm/examples/c++/maxds3231m.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "maxds3231m.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::MAXDS3231M *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- upm::Time3231 t;
- sensor = new upm::MAXDS3231M(0, ADDR);
-
- t.second = 1;
- t.minute = 3;
- t.hour = 3;
- t.day = 3;
- t.month = 3;
- t.year = 3;
- t.weekDay = 3;
- sensor->setDate (t); // Note, second should be set to 1.
-
- usleep (500000);
-
- while (!doWork) {
- if (sensor->getDate (t)) {
- std::cout << (int)t.hour << ":" << (int)t.minute << ":" << (int)t.second << std::endl;
- }
- std::cout << "Temperature " << sensor->getTemperature() << std::endl;
- usleep (1000000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/maxsonarez.cxx b/peripheral/libupm/examples/c++/maxsonarez.cxx
deleted file mode 100644
index 3c3d300..0000000
--- a/peripheral/libupm/examples/c++/maxsonarez.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "maxsonarez.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-#define MAXSONAREZ_AREF 5.0
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a MaxSonarEZ on analog pin A1, with an analog
- // reference voltage of MAXSONAREZ_AREF
- upm::MAXSONAREZ *sonar = new upm::MAXSONAREZ(1, MAXSONAREZ_AREF);
-
- // Every second, sample the sonar and output the distance to an
- // object in inches.
-
- // With the EZ3 version, the minimum and maximum ranges seemed to be
- // between 6 and 33 inches
-
- while (shouldRun)
- {
- cout << "AREF: " << MAXSONAREZ_AREF
- << ", distance in inches: " << sonar->inches() << endl;
-
- sleep(1);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sonar;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mcp9808.cxx b/peripheral/libupm/examples/c++/mcp9808.cxx
deleted file mode 100644
index ba4e5e4..0000000
--- a/peripheral/libupm/examples/c++/mcp9808.cxx
+++ /dev/null
@@ -1,163 +0,0 @@
-#include <iostream>
-#include <unistd.h>
-#include "mcp9808.h"
-
-#include "mraa.hpp"
-
-int main()
-{
- using namespace std;
-
-//! [Interesting]
- int command;
- upm::MCP9808 *temp = new upm::MCP9808(6);
-
- do
- {
- cout << endl;
- cout << "1 - read temp \t" ;
- cout << "2 - sleep mode \t";
- cout << "3 - wake up" << endl;
- cout << "4 - set mode to " << (temp->isCelsius() == true ? "Fahrenheit" : "Celcius") << endl;
- cout << "5 - show status bits" << endl;
- cout << "6 - Set Tcrit \t" ;
- cout << "7 - Set Tupper \t" ;
- cout << "8 - Set Tlower " << endl;
- cout << "9 - Display monitor temps " << endl;
- cout << "10 - Enable alert default\t";
- cout << "11 - Enable alert interrupt" << endl;
- cout << "12 - Clear interrupt \t" ;
- cout << "13 - Clear alert mode" << endl;
- cout << "14 - Get Hysteresis\t";
- cout << "15 - Set Hysteresis" << endl;
- cout << "16 - Get Resolution\t";
- cout << "17 - Set Resolution" << endl;
- cout << "18 - Get Manufacturer ID"<< endl;
- cout << "19 - Get Device ID" << endl;
- cout << "-1 - exit" << endl;
- cout << "Enter a command: ";
- cin >> command;
-
- switch(command)
- {
- float t;
- case 1:
- std::cout << "Temp: " << temp->getTemp() << "° " << (temp->isCelsius()? "Celsius" : "Fahrenheit")<< std::endl;
- break;
- case 2:
- cout << "shutdown sensor (sleep mode)" << endl;
- temp->shutDown();
- break;
- case 3:
- cout << "wake up sensor" << endl;
- temp->shutDown(false);
- break;
- case 4:
- cout << "set mode to " << (temp->isCelsius() ? "Fahrenheit" : "Celcius") << endl;
- temp->setMode(!temp->isCelsius());
- break;
- case 5:
- cout << "Tcrit = " << temp->isTcrit();
- cout << " Tupper = " << temp->isTupper();
- cout << " Tlower = " << temp->isTlower();
- break;
- case 6:
- cout << "enter a value";
- cin >> t;
- temp->setMonitorReg(temp->CRIT_TEMP, t);
- break;
- case 7:
- cout << "enter a value";
- cin >> t;
- temp->setMonitorReg(temp->UPPER_TEMP, t);
- break;
- case 8:
- cout << "enter a value";
- cin >> t;
- temp->setMonitorReg(temp->LOWER_TEMP, t);
- break;
- case 9:
- cout << "tcrit = " << temp->getMonitorReg(temp->CRIT_TEMP) << endl;
- cout << "tupper = " << temp->getMonitorReg(temp->UPPER_TEMP) << endl;
- cout << "tlower = " << temp->getMonitorReg(temp->LOWER_TEMP) << endl;
- break;
- case 10:
- cout << "set alert mode default" ;
- temp->setAlertMode(temp->ALERTCTRL);
- break;
- case 11:
- cout << "set alert mode interrupt";
- temp->setAlertMode(temp->ALERTMODE | temp->ALERTCTRL );
- break;
- case 12:
- temp->clearInterrupt();
- break;
- case 13:
- cout << "Clear alerts" << endl;
- temp->clearAlertMode();
- break;
- case 14:
- cout << "Hysteresis: " << temp->getHysteresis() << endl;
- break;
- case 15:
- int u;
- cout << "enter 1 to 4";
- cin >> u ;
- switch(u)
- {
- case 1:
- temp->setHysteresis(temp->HYST_0);
- break;
- case 2:
- temp->setHysteresis(temp->HYST_1_5);
- break;
- case 3:
- temp->setHysteresis(temp->HYST_3_0);
- break;
- case 4:
- default:
- temp->setHysteresis(temp->HYST_6_0);
- break;
- }
- break;
- case 16:
- cout << "Resolution: " << temp->getResolution() << endl;
- break;
- case 17:
- int v;
- cout << "enter 1 to 4";
- cin >> v ;
- switch(v)
- {
- case 1:
- temp->setResolution(temp->RES_LOW);
- break;
- case 2:
- temp->setResolution(temp->RES_MEDIUM);
- break;
- case 3:
- temp->setResolution(temp->RES_HIGH);
- break;
- case 4:
- default:
- temp->setResolution(temp->RES_PRECISION);
- break;
- }
- break;
- case 18:
- cout << "Manufacturer ID: " << std::hex << temp->getManufacturer() << endl;
- break;
- case 19:
- cout << "Get device ID: " << std::hex << temp->getDevicedId() << endl;
- break;
- case -1:
- break;
- default:
- cout << endl << "That option is not available. Try again" << endl;
- break;
- }
-
- }while (command != -1 );
-//! [Interesting]
- return MRAA_SUCCESS;
-}
diff --git a/peripheral/libupm/examples/c++/mg811.cxx b/peripheral/libupm/examples/c++/mg811.cxx
deleted file mode 100644
index b17423c..0000000
--- a/peripheral/libupm/examples/c++/mg811.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mg811.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-#define MG811_AREF 5.0
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate an MG811 on analog pin A0, and digital pin D2 with an
- // analog reference voltage of MG811_AREF (5.0)
- upm::MG811 *sensor = new upm::MG811(0, 2, MG811_AREF);
-
- // Every tenth of a second, sample the sensor and output it's
- // detected CO2 concentration in parts per million (ppm)
-
- while (shouldRun)
- {
- cout << "CO2 concentration in PPM: " << sensor->ppm() << endl;
-
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mhz16.cxx b/peripheral/libupm/examples/c++/mhz16.cxx
deleted file mode 100644
index 542dc5f..0000000
--- a/peripheral/libupm/examples/c++/mhz16.cxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mhz16.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main (int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a MHZ16 serial CO2 sensor on uart 0.
- // This example was tested on the Grove CO2 sensor module.
-
- upm::MHZ16* co2 = new upm::MHZ16(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!co2->setupTty(B9600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- cout << "Make sure that the sensor has had at least 3 minutes to warm up"
- << endl;
- cout << "or you will not get valid results." << endl;
- cout << "The temperature reported is not the ambient temperature, " << endl;
- cout << "but rather the temperature of the sensor elements." << endl;
-
- sleep(1);
-
- while (shouldRun)
- {
- if(!co2->getData()){
- cerr << "Failed to retrieve data" << endl;
- continue;
- }
-
- cout << "CO2 concentration: " << co2->getGas() << " PPM, "
- << "Temperature (in C): " << co2->getTemperature() <<endl;
-
- sleep(2);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete co2;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mic.cxx b/peripheral/libupm/examples/c++/mic.cxx
deleted file mode 100644
index 8773d71..0000000
--- a/peripheral/libupm/examples/c++/mic.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mic.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-uint16_t buffer [128];
-upm::Microphone *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- // Attach microphone to analog port A0
- sensor = new upm::Microphone(0);
- signal(SIGINT, sig_handler);
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of the averages
- while (!is_running) {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/micsv89.cxx b/peripheral/libupm/examples/c++/micsv89.cxx
deleted file mode 100644
index cf1530b..0000000
--- a/peripheral/libupm/examples/c++/micsv89.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <iostream>
-#include <unistd.h>
-#include <signal.h>
-#include "micsv89.h"
-
-/*
- * An example for using the MICSV89 sensor library.
- * The MICSV89 comes in 4 variants, PWM and I2c
- * in 3.3 volts and 5 volts. This library only implements
- * the I2c version of the device.
- *
- * Device output is not valid until a warm up of 15 minutes
- * of operation.
- *
- * Additional linker flags: -lupm-micsv89
- */
-
-using namespace std;
-
-volatile int running = 1;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- cout << "Exiting program." << endl;
- running = 0;
- }
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- upm::MICSV89 *sensor = new upm::MICSV89(6);
-
- while(running)
- {
- sensor->update();
- while(!sensor->valid());
- cout << "co2: " << sensor->co2equ() << endl;
- cout << "short: " << sensor->vocshort() << endl;
- cout << "tvoc: " << sensor->tvoc() << endl;
- cout << "resistor: " << sensor->resistor() << endl;
- cout << "****************************" << endl;
- sleep(5);
- }
-
- delete sensor;
-//! [Interesting]
-
- return MRAA_SUCCESS;
-}
diff --git a/peripheral/libupm/examples/c++/mlx90614.cxx b/peripheral/libupm/examples/c++/mlx90614.cxx
deleted file mode 100644
index dbd00f4..0000000
--- a/peripheral/libupm/examples/c++/mlx90614.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mlx90614.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::MLX90614 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- sensor = new upm::MLX90614(0, DEVICE_ADDR);
-
- while (!doWork) {
- std::cout << "Object Temperature (" << sensor->readObjectTempC() << ") Ambient Temperature (" << sensor->readAmbientTempC() << ")" << std::endl;
- usleep (1000000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mma7455.cxx b/peripheral/libupm/examples/c++/mma7455.cxx
deleted file mode 100644
index 052919f..0000000
--- a/peripheral/libupm/examples/c++/mma7455.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mma7455.h"
-#include <signal.h>
-#include <pthread.h>
-
-int doWork = 0;
-upm::MMA7455 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- sensor = new upm::MMA7455(0, ADDR);
-
- short x, y, z;
- while (!doWork) {
- sensor->readData(&x, &y, &z);
- std::cout << "Accelerometer X(" << x << ") Y(" << y << ") Z(" << z << ")" << std::endl;
- usleep (100000);
- }
-
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mma7660.cxx b/peripheral/libupm/examples/c++/mma7660.cxx
deleted file mode 100644
index c426db5..0000000
--- a/peripheral/libupm/examples/c++/mma7660.cxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "mma7660.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an MMA7660 on I2C bus 0
-
- upm::MMA7660 *accel = new upm::MMA7660(MMA7660_I2C_BUS,
- MMA7660_DEFAULT_I2C_ADDR);
-
- // place device in standby mode so we can write registers
- accel->setModeStandby();
-
- // enable 64 samples per second
- accel->setSampleRate(upm::MMA7660::AUTOSLEEP_64);
-
- // place device into active mode
- accel->setModeActive();
-
- while (shouldRun)
- {
- int x, y, z;
-
- accel->getRawValues(&x, &y, &z);
- cout << "Raw values: x = " << x
- << " y = " << y
- << " z = " << z
- << endl;
-
- float ax, ay, az;
-
- accel->getAcceleration(&ax, &ay, &az);
- cout << "Acceleration: x = " << ax
- << "g y = " << ay
- << "g z = " << az
- << "g" << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete accel;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mpl3115a2.cxx b/peripheral/libupm/examples/c++/mpl3115a2.cxx
deleted file mode 100644
index f9499d1..0000000
--- a/peripheral/libupm/examples/c++/mpl3115a2.cxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Author: William Penner <william.penner@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "mpl3115a2.h"
-
-volatile int doWork = 0;
-
-upm::MPL3115A2 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT) {
- printf("\nCtrl-C received.\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- // Register signal handler
- signal(SIGINT, sig_handler);
-
- //! [Interesting]
- float pressure = 0.0;
- float temperature = 0.0;
- float altitude = 0.0;
- float sealevel = 0.0;
-
- sensor = new upm::MPL3115A2(0, MPL3115A2_I2C_ADDRESS);
-
- sensor->testSensor();
-
- while (!doWork) {
- temperature = sensor->getTemperature(true);
- pressure = sensor->getPressure(false);
- altitude = sensor->getAltitude();
- sealevel = sensor->getSealevelPressure();
-
- std::cout << "pressure value = " <<
- pressure <<
- ", altitude value = " <<
- altitude <<
- ", sealevel value = " <<
- sealevel <<
- ", temperature = " <<
- temperature << std::endl;
- usleep (500000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mpr121.cxx b/peripheral/libupm/examples/c++/mpr121.cxx
deleted file mode 100644
index 7998965..0000000
--- a/peripheral/libupm/examples/c++/mpr121.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "mpr121.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-void printButtons(upm::MPR121 *touch)
-{
- bool buttonPressed = false;
-
- cout << "Buttons Pressed: ";
- for (int i=0; i<12; i++)
- {
- if (touch->m_buttonStates & (1 << i))
- {
- cout << i << " ";
- buttonPressed = true;
- }
- }
-
- if (!buttonPressed)
- cout << "None";
-
- if (touch->m_overCurrentFault)
- cout << "Over Current Fault detected!" << endl;
-
- cout << endl;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an MPR121 on I2C bus 0
-
- upm::MPR121 *touch = new upm::MPR121(MPR121_I2C_BUS, MPR121_DEFAULT_I2C_ADDR);
-
- // init according to AN3944 defaults
- touch->configAN3944();
-
- while (shouldRun)
- {
- touch->readButtons();
- printButtons(touch);
- sleep(1);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete touch;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mpu60x0.cxx b/peripheral/libupm/examples/c++/mpu60x0.cxx
deleted file mode 100644
index d90a017..0000000
--- a/peripheral/libupm/examples/c++/mpu60x0.cxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mpu9150.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- upm::MPU60X0 *sensor = new upm::MPU60X0();
-
- sensor->init();
-
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getAccelerometer(&x, &y, &z);
- cout << "Accelerometer: ";
- cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
-
- sensor->getGyroscope(&x, &y, &z);
- cout << "Gryoscope: ";
- cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
-
- cout << "Temperature: " << sensor->getTemperature() << endl;
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mpu9150.cxx b/peripheral/libupm/examples/c++/mpu9150.cxx
deleted file mode 100644
index d6f5da5..0000000
--- a/peripheral/libupm/examples/c++/mpu9150.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mpu9150.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- upm::MPU9150 *sensor = new upm::MPU9150();
-
- sensor->init();
-
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getAccelerometer(&x, &y, &z);
- cout << "Accelerometer: ";
- cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
-
- sensor->getGyroscope(&x, &y, &z);
- cout << "Gryoscope: ";
- cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
-
- sensor->getMagnetometer(&x, &y, &z);
- cout << "Magnetometer: ";
- cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
-
- cout << "Temperature: " << sensor->getTemperature() << endl;
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mpu9250.cxx b/peripheral/libupm/examples/c++/mpu9250.cxx
deleted file mode 100644
index fd093f9..0000000
--- a/peripheral/libupm/examples/c++/mpu9250.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mpu9250.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- upm::MPU9250 *sensor = new upm::MPU9250();
-
- sensor->init();
-
- while (shouldRun)
- {
- sensor->update();
-
- float x, y, z;
-
- sensor->getAccelerometer(&x, &y, &z);
- cout << "Accelerometer: ";
- cout << "AX: " << x << " AY: " << y << " AZ: " << z << endl;
-
- sensor->getGyroscope(&x, &y, &z);
- cout << "Gryoscope: ";
- cout << "GX: " << x << " GY: " << y << " GZ: " << z << endl;
-
- sensor->getMagnetometer(&x, &y, &z);
- cout << "Magnetometer: ";
- cout << "MX = " << x << " MY = " << y << " MZ = " << z << endl;
-
- cout << "Temperature: " << sensor->getTemperature() << endl;
- cout << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mq2.cxx b/peripheral/libupm/examples/c++/mq2.cxx
deleted file mode 100644
index f3bd9ca..0000000
--- a/peripheral/libupm/examples/c++/mq2.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq2.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-uint16_t buffer [128];
-upm::MQ2 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- // Attach gas sensor to A0
- sensor = new upm::MQ2(0);
- signal(SIGINT, sig_handler);
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 milliseconds;
- // find the average of 128 samples; and
- // print a running graph of the averages using a resolution of 5
- while (!is_running) {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq3.cxx b/peripheral/libupm/examples/c++/mq3.cxx
deleted file mode 100644
index 9fd3cce..0000000
--- a/peripheral/libupm/examples/c++/mq3.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq3.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-uint16_t buffer [128];
-upm::MQ3 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- // Attach gas sensor to A0
- sensor = new upm::MQ3(0);
- signal(SIGINT, sig_handler);
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 milliseconds;
- // find the average of 128 samples; and
- // print a running graph of the averages using a resolution of 5
- while (!is_running) {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq303a.cxx b/peripheral/libupm/examples/c++/mq303a.cxx
deleted file mode 100644
index 4557de0..0000000
--- a/peripheral/libupm/examples/c++/mq303a.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "mq303a.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an mq303a sensor on analog pin A0
-
- // This device uses a heater powered from an analog I/O pin.
- // If using A0 as the data pin, then you need to use A1, as the heater
- // pin (if using a grove mq303a). For A1, we can use the D15 gpio,
- // setup as an output, and drive it low to power the heater.
-
- upm::MQ303A *mq303a = new upm::MQ303A(0, 15);
-
- cout << "Enabling heater and waiting 2 minutes for warmup." << endl;
- mq303a->heaterEnable(true);
- sleep(120);
-
- cout << "This sensor may need to warm until the value drops below about 450."
- << endl;
-
- // Print the detected alcohol value every second
- while (shouldRun)
- {
- int val = mq303a->value();
-
- cout << "Alcohol detected (higher means stronger alcohol): "
- << val << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
- mq303a->heaterEnable(false);
-
- delete mq303a;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/mq4.cxx b/peripheral/libupm/examples/c++/mq4.cxx
deleted file mode 100644
index 686970b..0000000
--- a/peripheral/libupm/examples/c++/mq4.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq4.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-bool shouldRun = true;
-
-using namespace std;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- {
- shouldRun = false;
- }
-}
-
-//! [Interesting]
-int main(int argc, char **argv)
-{
- // Attach gas sensor to Analog A0
- upm::MQ4 *sensor = new upm::MQ4(0);
- signal(SIGINT, sig_handler);
-
- uint16_t buffer [128];
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of asteriskss as averages
- while (shouldRun)
- {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- cout << "Exiting" << endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq5.cxx b/peripheral/libupm/examples/c++/mq5.cxx
deleted file mode 100644
index 541bb26..0000000
--- a/peripheral/libupm/examples/c++/mq5.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq5.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-uint16_t buffer [128];
-upm::MQ5 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- sensor = new upm::MQ5(0);
- signal(SIGINT, sig_handler);
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- while (!is_running) {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 7);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq6.cxx b/peripheral/libupm/examples/c++/mq6.cxx
deleted file mode 100644
index 0a73af1..0000000
--- a/peripheral/libupm/examples/c++/mq6.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq6.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-bool shouldRun = true;
-
-using namespace std;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- {
- shouldRun = false;
- }
-}
-
-//! [Interesting]
-int main(int argc, char **argv)
-{
- // Attach gas sensor to Analog A0
- upm::MQ6 *sensor = new upm::MQ6(0);
- signal(SIGINT, sig_handler);
-
- uint16_t buffer [128];
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of asteriskss as averages
- while (shouldRun)
- {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- cout << "Exiting" << endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq7.cxx b/peripheral/libupm/examples/c++/mq7.cxx
deleted file mode 100644
index a6279f1..0000000
--- a/peripheral/libupm/examples/c++/mq7.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq7.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-bool shouldRun = true;
-
-using namespace std;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- {
- shouldRun = false;
- }
-}
-
-//! [Interesting]
-int main(int argc, char **argv)
-{
- // Attach gas sensor to Analog A0
- upm::MQ7 *sensor = new upm::MQ7(0);
- signal(SIGINT, sig_handler);
-
- uint16_t buffer [128];
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of asteriskss as averages
- while (shouldRun)
- {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- cout << "Exiting" << endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq8.cxx b/peripheral/libupm/examples/c++/mq8.cxx
deleted file mode 100644
index eae583f..0000000
--- a/peripheral/libupm/examples/c++/mq8.cxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq8.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-bool shouldRun = true;
-
-using namespace std;
-
-void
-sig_handler(int signo)
-{
- if (signo == SIGINT)
- {
- shouldRun = false;
- }
-}
-
-//! [Interesting]
-int main(int argc, char **argv)
-{
- // Attach gas sensor to Analog A0
- upm::MQ8 *sensor = new upm::MQ8(0);
- signal(SIGINT, sig_handler);
-
- uint16_t buffer [128];
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- // Infinite loop, ends when script is cancelled
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of asteriskss as averages
- while (shouldRun)
- {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- cout << "Exiting" << endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/mq9.cxx b/peripheral/libupm/examples/c++/mq9.cxx
deleted file mode 100644
index b62dad3..0000000
--- a/peripheral/libupm/examples/c++/mq9.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "mq9.h"
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-int is_running = 0;
-uint16_t buffer [128];
-upm::MQ9 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
-}
-
-//! [Interesting]
-int
-main(int argc, char **argv)
-{
- sensor = new upm::MQ9(0);
- signal(SIGINT, sig_handler);
-
- thresholdContext ctx;
- ctx.averageReading = 0;
- ctx.runningAverage = 0;
- ctx.averagedOver = 2;
-
- while (!is_running) {
- int len = sensor->getSampledWindow (2, 128, buffer);
- if (len) {
- int thresh = sensor->findThreshold (&ctx, 30, buffer, len);
- sensor->printGraph(&ctx, 5);
- if (thresh) {
- // do something ....
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/nlgpio16.cxx b/peripheral/libupm/examples/c++/nlgpio16.cxx
deleted file mode 100644
index 44c901e..0000000
--- a/peripheral/libupm/examples/c++/nlgpio16.cxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdio.h>
-#include "nlgpio16.h"
-
-using namespace std;
-using namespace upm;
-
-int main(int argc, char **argv)
-{
- // Instantiate a NLGPIO16 Module on the default UART (/dev/ttyACM0)
- upm::NLGPIO16* sensor = new upm::NLGPIO16();
-
- // get the Version
- cout << "Device Version: " << sensor->getVersion() << endl;
- // read the gpio at pin 3
- cout << "GPIO 3 Value: " << sensor->gpioRead(3) << endl;
- // read the analog voltage at pin 5
- cout << "Analog 5 Voltage: " << sensor->analogReadVolts(5) << endl;
- // set the gpio at pin 14 to HIGH
- sensor->gpioSet(14);
-
- delete sensor;
- return 0;
-}
-
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/nrf24l01-broadcast.cxx b/peripheral/libupm/examples/c++/nrf24l01-broadcast.cxx
deleted file mode 100644
index f4a1d21..0000000
--- a/peripheral/libupm/examples/c++/nrf24l01-broadcast.cxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <iostream>
-#include "nrf24l01.h"
-#include <signal.h>
-#include <stdio.h>
-#include <vector>
-
-int running = 0;
-upm::NRF24L01 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- running = 1;
- }
-}
-
-void nrf_handler () {
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
-
- sensor = new upm::NRF24L01(7, 8);
- sensor->setBeaconingMode ();
-
- std::vector<std::string> msgs;
-
- msgs.push_back ("Hello World 1!!!");
- msgs.push_back ("Hello World 2!!!");
- msgs.push_back ("Hello World 3!!!");
- msgs.push_back ("Hello World 4!!!");
- msgs.push_back ("Hello World 5!!!");
-
- signal(SIGINT, sig_handler);
-
- while (!running) {
- for (std::vector<std::string>::iterator item = msgs.begin(); item != msgs.end(); ++item) {
- std::cout << "BROADCASTING " << (*item).c_str() << std::endl;
-
- for (int i = 0; i < 3; i++) {
- sensor->sendBeaconingMsg ((uint8_t*) (*item).c_str());
- usleep (1000000);
- }
- }
- }
-
- std::cout << "exiting application" << std::endl;
-
- msgs.clear();
- delete sensor;
-
- //! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/nrf24l01-receiver.cxx b/peripheral/libupm/examples/c++/nrf24l01-receiver.cxx
deleted file mode 100644
index 344cb0c..0000000
--- a/peripheral/libupm/examples/c++/nrf24l01-receiver.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <iostream>
-#include "nrf24l01.h"
-#include <signal.h>
-
-int running = 0;
-upm::NRF24L01 *comm = NULL;
-
-uint8_t local_address[5] = {0x01, 0x01, 0x01, 0x01, 0x01};
-uint8_t broadcast_address[5] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- running = 1;
- }
-}
-
-//! [Interesting]
-void nrf_handler () {
- std::cout << "Reciever :: " << *((uint32_t *)&(comm->m_rxBuffer[0])) << std::endl;
-}
-
-int
-main(int argc, char **argv)
-{
-
- comm = new upm::NRF24L01(7, 8);
- comm->setSourceAddress ((uint8_t *) local_address);
- comm->setDestinationAddress ((uint8_t *) broadcast_address);
- comm->setPayload (MAX_BUFFER);
- comm->configure ();
- comm->setSpeedRate (upm::NRF_250KBPS);
- comm->setChannel (99);
- comm->setDataReceivedHandler (nrf_handler);
-
- signal(SIGINT, sig_handler);
-
- while (!running) {
- comm->pollListener ();
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete comm;
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/nrf24l01-transmitter.cxx b/peripheral/libupm/examples/c++/nrf24l01-transmitter.cxx
deleted file mode 100644
index 5d9f7cc..0000000
--- a/peripheral/libupm/examples/c++/nrf24l01-transmitter.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <iostream>
-#include "nrf24l01.h"
-#include <signal.h>
-
-int running = 0;
-upm::NRF24L01 *comm = NULL;
-
-uint8_t destAddress[5] = {0x01, 0x01, 0x01, 0x01, 0x01};
-uint8_t srcAddress[5] = {0x01, 0x01, 0x01, 0x01, 0x02};
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- running = 1;
- }
-}
-
-void nrf_handler () {
-}
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- uint32_t dummyData = 0;
- comm = new upm::NRF24L01(7, 8);
- comm->setSourceAddress ((uint8_t *) srcAddress);
- comm->setDestinationAddress ((uint8_t *) destAddress);
- comm->setPayload (MAX_BUFFER);
- comm->setChannel (99);
- comm->configure ();
- comm->setDataReceivedHandler (nrf_handler);
-
- signal(SIGINT, sig_handler);
-
- while (!running) {
- memcpy (comm->m_txBuffer, &dummyData, sizeof (dummyData));
- comm->send ();
- std::cout << "devi2 :: sending data ...." << dummyData << std::endl;
- usleep (3000000);
- dummyData += 3000;
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete comm;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/nrf8001-broadcast.cxx b/peripheral/libupm/examples/c++/nrf8001-broadcast.cxx
deleted file mode 100644
index 534e32b..0000000
--- a/peripheral/libupm/examples/c++/nrf8001-broadcast.cxx
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "nrf8001.h"
-#include "nrf8001-broadcast.h"
-#include <lib_aci.h>
-#include <aci_setup.h>
-#include <signal.h>
-
-#ifdef SERVICES_PIPE_TYPE_MAPPING_CONTENT
- static services_pipe_type_mapping_t
- services_pipe_type_mapping[NUMBER_OF_PIPES] = SERVICES_PIPE_TYPE_MAPPING_CONTENT;
-#else
- #define NUMBER_OF_PIPES 0
- static services_pipe_type_mapping_t * services_pipe_type_mapping = NULL;
-#endif
-
-/**
- * Store the setup for the nRF8001 in the flash of the AVR to save on RAM
- */
-static hal_aci_data_t setup_msgs[NB_SETUP_MESSAGES] = SETUP_MESSAGES_CONTENT;
-
-/**
- * aci_struct that will contain
- * total initial credits
- * current credit
- * current state of the aci (setup/standby/active/sleep)
- * open remote pipe pending
- * close remote pipe pending
- * Current pipe available bitmap
- * Current pipe closed bitmap
- * Current connection interval, slave latency and link supervision timeout
- * Current State of the the GATT client (Service Discovery)
- * Status of the bond (R) Peer address
- */
-static struct aci_state_t aci_state;
-
-/**
- * Temporary buffers for sending ACI commands
- */
-static hal_aci_evt_t aci_data;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- }
-}
-
-void
-init_aci_setup () {
- /**
- * Point ACI data structures to the the setup data that the nRFgo studio generated for the nRF8001
- */
- if (NULL != services_pipe_type_mapping) {
- aci_state.aci_setup_info.services_pipe_type_mapping = &services_pipe_type_mapping[0];
- } else {
- aci_state.aci_setup_info.services_pipe_type_mapping = NULL;
- }
-
- aci_state.aci_setup_info.number_of_pipes = NUMBER_OF_PIPES;
- aci_state.aci_setup_info.setup_msgs = setup_msgs;
- aci_state.aci_setup_info.num_setup_msgs = NB_SETUP_MESSAGES;
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
-
- init_aci_setup ();
- init_local_interfaces (&aci_state, 10, 8, 4);
-
- while (1) {
- static bool setup_required = false;
- if (lib_aci_event_get (&aci_state, &aci_data)) {
- aci_evt_t * aci_evt;
- aci_evt = &aci_data.evt;
-
- switch(aci_evt->evt_opcode) {
- /**
- As soon as you reset the nRF8001 you will get an ACI Device Started Event
- */
- case ACI_EVT_DEVICE_STARTED: {
- aci_state.data_credit_available = aci_evt->params.device_started.credit_available;
- switch(aci_evt->params.device_started.device_mode) {
- case ACI_DEVICE_SETUP:
- /**
- When the device is in the setup mode
- */
- printf ("Evt Device Started: Setup\n");
- setup_required = true;
- break;
-
- case ACI_DEVICE_STANDBY:
- printf ("Evt Device Started: Standby\n");
- lib_aci_broadcast(10/* in seconds */, 0x0100 /* advertising interval 100ms */);
- printf ("Broadcasting started\n");
- break;
- }
- }
- break; //ACI Device Started Event
-
- case ACI_EVT_CMD_RSP:
- if (ACI_STATUS_SUCCESS != aci_evt->params.cmd_rsp.cmd_status) {
- printf ("ACI_EVT_CMD_RSP\n");
- while (1);
- }
- break;
-
- case ACI_EVT_CONNECTED:
- printf ("ACI_EVT_CONNECTED\n");
- break;
-
- case ACI_EVT_PIPE_STATUS:
- printf ("ACI_EVT_PIPE_STATUS\n");
- break;
-
- case ACI_EVT_DISCONNECTED:
- if (ACI_STATUS_ERROR_ADVT_TIMEOUT == aci_evt->params.disconnected.aci_status) {
- printf ("Broadcasting timed out\n");
- } else {
- printf ("Evt Disconnected. Link Loss\n");
- }
- break;
-
- case ACI_EVT_DATA_RECEIVED:
- printf ("ACI_EVT_DATA_RECEIVED\n");
- break;
-
- case ACI_EVT_HW_ERROR:
- printf ("ACI_EVT_HW_ERROR\n");
- break;
- }
- }
-
- if (setup_required) {
- if (SETUP_SUCCESS == do_aci_setup(&aci_state)) {
- setup_required = false;
- }
- }
- usleep (100);
- }
-
- close_local_interfaces (&aci_state);
-
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/nrf8001-broadcast.h b/peripheral/libupm/examples/c++/nrf8001-broadcast.h
deleted file mode 100644
index b6f8cb5..0000000
--- a/peripheral/libupm/examples/c++/nrf8001-broadcast.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#include "hal_platform.h"
-#include "aci.h"
-
-#pragma once
-
-#define PIPE_GAP_DEVICE_NAME_SET 1
-
-#define NUMBER_OF_PIPES 1
-
-#define SERVICES_PIPE_TYPE_MAPPING_CONTENT {\
- {ACI_STORE_LOCAL, ACI_SET}, \
-}
-
-#define GAP_PPCP_MAX_CONN_INT 0xffff /**< Maximum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific value requested */
-#define GAP_PPCP_MIN_CONN_INT 0xffff /**< Minimum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific maximum*/
-#define GAP_PPCP_SLAVE_LATENCY 0
-#define GAP_PPCP_CONN_TIMEOUT 0xffff /** Connection Supervision timeout multiplier as a multiple of 10msec, 0xFFFF means no specific value requested */
-
-#define NB_SETUP_MESSAGES 13
-#define SETUP_MESSAGES_CONTENT {\
- {0x00,\
- {\
- 0x07,0x06,0x00,0x00,0x03,0x02,0x41,0xd7,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x01,0x00,0x00,0x06,0x00,0x01,\
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x10,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x90,0x00,0x64,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x10,0x38,0x02,0xff,0x02,0x58,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x05,0x06,0x10,0x54,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x00,0x04,0x04,0x02,0x02,0x00,0x01,0x28,0x00,0x01,0x00,0x18,0x04,0x04,0x05,0x05,0x00,\
- 0x02,0x28,0x03,0x01,0x0e,0x03,0x00,0x00,0x2a,0x04,0x14,0x0b,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x1c,0x05,0x00,0x03,0x2a,0x00,0x01,0x62,0x63,0x61,0x73,0x74,0x63,0x73,0x65,0x6d,0x69,\
- 0x2e,0x04,0x04,0x05,0x05,0x00,0x04,0x28,0x03,0x01,0x02,0x05,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x38,0x00,0x01,0x2a,0x06,0x04,0x03,0x02,0x00,0x05,0x2a,0x01,0x01,0x00,0x00,0x04,0x04,\
- 0x05,0x05,0x00,0x06,0x28,0x03,0x01,0x02,0x07,0x00,0x04,0x2a,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x54,0x06,0x04,0x09,0x08,0x00,0x07,0x2a,0x04,0x01,0xff,0xff,0xff,0xff,0x00,0x00,0xff,\
- 0xff,0x04,0x04,0x02,0x02,0x00,0x08,0x28,0x00,0x01,0x01,0x18,\
- },\
- },\
- {0x00,\
- {\
- 0x04,0x06,0x20,0x70,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x0d,0x06,0x40,0x00,0x2a,0x00,0x01,0x00,0x80,0x04,0x00,0x03,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x06,0x06,0x60,0x00,0x00,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x06,0x06,0xf0,0x00,0x03,0x4c,0xf2,\
- },\
- },\
-}
diff --git a/peripheral/libupm/examples/c++/nrf8001-helloworld.cxx b/peripheral/libupm/examples/c++/nrf8001-helloworld.cxx
deleted file mode 100644
index 5866a0f..0000000
--- a/peripheral/libupm/examples/c++/nrf8001-helloworld.cxx
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "nrf8001.h"
-#include "nrf8001-helloworld.h"
-#include <lib_aci.h>
-#include <aci_setup.h>
-#include <signal.h>
-#include "uart_over_ble.h"
-
-/*
- * You can use the nRF UART app in the Apple iOS app store and Google Play for Android 4.3 for Samsung Galaxy S4
- * with this helloworld application
- */
-
-#ifdef SERVICES_PIPE_TYPE_MAPPING_CONTENT
- static services_pipe_type_mapping_t
- services_pipe_type_mapping[NUMBER_OF_PIPES] = SERVICES_PIPE_TYPE_MAPPING_CONTENT;
-#else
- #define NUMBER_OF_PIPES 0
- static services_pipe_type_mapping_t * services_pipe_type_mapping = NULL;
-#endif
-
-/**
- * Store the setup for the nRF8001 in the flash of the AVR to save on RAM
- */
-static hal_aci_data_t setup_msgs[NB_SETUP_MESSAGES] = SETUP_MESSAGES_CONTENT;
-
-/**
- * aci_struct that will contain
- * total initial credits
- * current credit
- * current state of the aci (setup/standby/active/sleep)
- * open remote pipe pending
- * close remote pipe pending
- * Current pipe available bitmap
- * Current pipe closed bitmap
- * Current connection interval, slave latency and link supervision timeout
- * Current State of the the GATT client (Service Discovery)
- * Status of the bond (R) Peer address
- */
-static struct aci_state_t aci_state;
-
-/**
- * Temporary buffers for sending ACI commands
- */
-static hal_aci_evt_t aci_data;
-
-/*
-Timing change state variable
-*/
-static bool timing_change_done = false;
-
-/*
-Used to test the UART TX characteristic notification
-*/
-static uart_over_ble_t uart_over_ble;
-static uint8_t uart_buffer[20];
-static uint8_t uart_buffer_len = 0;
-static uint8_t dummychar = 0;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- }
-}
-
-void
-init_aci_setup () {
- /**
- * Point ACI data structures to the the setup data that the nRFgo studio generated for the nRF8001
- */
- if (NULL != services_pipe_type_mapping) {
- aci_state.aci_setup_info.services_pipe_type_mapping = &services_pipe_type_mapping[0];
- } else {
- aci_state.aci_setup_info.services_pipe_type_mapping = NULL;
- }
-
- aci_state.aci_setup_info.number_of_pipes = NUMBER_OF_PIPES;
- aci_state.aci_setup_info.setup_msgs = setup_msgs;
- aci_state.aci_setup_info.num_setup_msgs = NB_SETUP_MESSAGES;
-}
-
-void
-uart_over_ble_init (void) {
- uart_over_ble.uart_rts_local = true;
-}
-
-bool
-uart_tx (uint8_t *buffer, uint8_t buffer_len) {
- bool status = false;
-
- if (lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX) &&
- (aci_state.data_credit_available >= 1)) {
- status = lib_aci_send_data(PIPE_UART_OVER_BTLE_UART_TX_TX, buffer, buffer_len);
- if (status) {
- aci_state.data_credit_available--;
- }
- }
-
- return status;
-}
-
-bool
-uart_process_control_point_rx(uint8_t *byte, uint8_t length) {
- bool status = false;
- aci_ll_conn_params_t *conn_params;
-
- if (lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_TX) ) {
- switch (*byte) {
- /*
- Queues a ACI Disconnect to the nRF8001 when this packet is received.
- May cause some of the UART packets being sent to be dropped
- */
- case UART_OVER_BLE_DISCONNECT:
- /*
- Parameters:
- None
- */
- lib_aci_disconnect(&aci_state, ACI_REASON_TERMINATE);
- status = true;
- break;
-
- /*
- Queues an ACI Change Timing to the nRF8001
- */
- case UART_OVER_BLE_LINK_TIMING_REQ:
- /*
- Parameters:
- Connection interval min: 2 bytes
- Connection interval max: 2 bytes
- Slave latency: 2 bytes
- Timeout: 2 bytes
- Same format as Peripheral Preferred Connection Parameters (See nRFgo studio -> nRF8001 Configuration -> GAP Settings
- Refer to the ACI Change Timing Request in the nRF8001 Product Specifications
- */
- conn_params = (aci_ll_conn_params_t *)(byte+1);
- lib_aci_change_timing( conn_params->min_conn_interval,
- conn_params->max_conn_interval,
- conn_params->slave_latency,
- conn_params->timeout_mult);
- status = true;
- break;
-
- /*
- Clears the RTS of the UART over BLE
- */
- case UART_OVER_BLE_TRANSMIT_STOP:
- /*
- Parameters:
- None
- */
- uart_over_ble.uart_rts_local = false;
- status = true;
- break;
-
-
- /*
- Set the RTS of the UART over BLE
- */
- case UART_OVER_BLE_TRANSMIT_OK:
- /*
- Parameters:
- None
- */
- uart_over_ble.uart_rts_local = true;
- status = true;
- break;
- }
- }
-
- return status;
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
-
- init_aci_setup ();
- init_local_interfaces (&aci_state, 10, 8, 4);
-
- while (1) {
- static bool setup_required = false;
-
- // We enter the if statement only when there is a ACI event available to be processed
- if (lib_aci_event_get(&aci_state, &aci_data)) {
- aci_evt_t * aci_evt;
- aci_evt = &aci_data.evt;
- switch(aci_evt->evt_opcode) {
- /**
- As soon as you reset the nRF8001 you will get an ACI Device Started Event
- */
- case ACI_EVT_DEVICE_STARTED: {
- aci_state.data_credit_total = aci_evt->params.device_started.credit_available;
- switch(aci_evt->params.device_started.device_mode) {
- case ACI_DEVICE_SETUP:
- /**
- When the device is in the setup mode
- */
- printf ("Evt Device Started: Setup \n");
- setup_required = true;
- break;
-
- case ACI_DEVICE_STANDBY:
- printf ("Evt Device Started: Standby \n");
- // Looking for an iPhone by sending radio advertisements
- // When an iPhone connects to us we will get an ACI_EVT_CONNECTED event from the nRF8001
- if (aci_evt->params.device_started.hw_error) {
- usleep (20000); //Handle the HW error event correctly.
- } else {
- lib_aci_connect(0/* in seconds : 0 means forever */, 0x0050 /* advertising interval 50ms*/);
- printf ("Advertising started \n");
- }
- break;
- }
- }
- break; // ACI Device Started Event
-
- case ACI_EVT_CMD_RSP:
- //If an ACI command response event comes with an error -> stop
- if (ACI_STATUS_SUCCESS != aci_evt->params.cmd_rsp.cmd_status) {
- //ACI ReadDynamicData and ACI WriteDynamicData will have status codes of
- //TRANSACTION_CONTINUE and TRANSACTION_COMPLETE
- //all other ACI commands will have status code of ACI_STATUS_SCUCCESS for a successful command
- printf ("ACI_EVT_CMD_RSP \n");
- }
- if (ACI_CMD_GET_DEVICE_VERSION == aci_evt->params.cmd_rsp.cmd_opcode) {
- //Store the version and configuration information of the nRF8001 in the Hardware Revision String Characteristic
- lib_aci_set_local_data(&aci_state, PIPE_DEVICE_INFORMATION_HARDWARE_REVISION_STRING_SET,
- (uint8_t *)&(aci_evt->params.cmd_rsp.params.get_device_version), sizeof(aci_evt_cmd_rsp_params_get_device_version_t));
- }
- break;
-
- case ACI_EVT_CONNECTED:
- printf ("ACI_EVT_CONNECTED");
- uart_over_ble_init ();
- timing_change_done = false;
- aci_state.data_credit_available = aci_state.data_credit_total;
-
- /*
- Get the device version of the nRF8001 and store it in the Hardware Revision String
- */
- lib_aci_device_version();
- break;
-
- case ACI_EVT_PIPE_STATUS:
- printf ("ACI_EVT_PIPE_STATUS \n");
- if (lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX) && (false == timing_change_done)) {
- lib_aci_change_timing_GAP_PPCP(); // change the timing on the link as specified in the nRFgo studio -> nRF8001 conf. -> GAP.
- // Used to increase or decrease bandwidth
- timing_change_done = true;
-
- char hello[]="Hello World, works";
- uart_tx((uint8_t *)&hello[0], strlen(hello));
- }
- break;
-
- case ACI_EVT_TIMING:
- printf ("Evt link connection interval changed \n");
- lib_aci_set_local_data(&aci_state,
- PIPE_UART_OVER_BTLE_UART_LINK_TIMING_CURRENT_SET,
- (uint8_t *)&(aci_evt->params.timing.conn_rf_interval), /* Byte aligned */
- PIPE_UART_OVER_BTLE_UART_LINK_TIMING_CURRENT_SET_MAX_SIZE);
- break;
-
- case ACI_EVT_DISCONNECTED:
- printf ("ACI_EVT_DISCONNECTED \n");
- lib_aci_connect(0/* in seconds : 0 means forever */, 0x0050 /* advertising interval 50ms*/);
- printf ("Advertising started \n");
- break;
-
- case ACI_EVT_DATA_RECEIVED:
- if (PIPE_UART_OVER_BTLE_UART_RX_RX == aci_evt->params.data_received.rx_data.pipe_number) {
- for(int i=0; i<aci_evt->len - 2; i++) {
- uart_buffer[i] = aci_evt->params.data_received.rx_data.aci_data[i];
- }
-
- uart_buffer_len = aci_evt->len - 2;
- if (lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX)) {
- }
- }
-
- if (PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_RX == aci_evt->params.data_received.rx_data.pipe_number) {
- //Subtract for Opcode and Pipe number
- uart_process_control_point_rx(&aci_evt->params.data_received.rx_data.aci_data[0], aci_evt->len - 2);
- }
-
- printf ("Incomming data - %s\n", uart_buffer);
- break;
-
- case ACI_EVT_DATA_CREDIT:
- printf ("ACI_EVT_DATA_CREDIT \n");
- aci_state.data_credit_available = aci_state.data_credit_available + aci_evt->params.data_credit.credit;
- break;
-
- case ACI_EVT_PIPE_ERROR:
- printf ("ACI_EVT_PIPE_ERROR \n");
- //Increment the credit available as the data packet was not sent.
- //The pipe error also represents the Attribute protocol Error Response sent from the peer and that should not be counted
- //for the credit.
- if (ACI_STATUS_ERROR_PEER_ATT_ERROR != aci_evt->params.pipe_error.error_code) {
- aci_state.data_credit_available++;
- }
- break;
-
- case ACI_EVT_HW_ERROR:
- printf ("ACI_EVT_HW_ERROR \n");
- lib_aci_connect(0/* in seconds, 0 means forever */, 0x0050 /* advertising interval 50ms*/);
- printf ("Advertising started \n");
- break;
-
- }
- }
-
- /* setup_required is set to true when the device starts up and enters setup mode.
- * It indicates that do_aci_setup() should be called. The flag should be cleared if
- * do_aci_setup() returns ACI_STATUS_TRANSACTION_COMPLETE.
- */
- if(setup_required) {
- if (SETUP_SUCCESS == do_aci_setup(&aci_state)) {
- setup_required = false;
- }
- }
-
- usleep (100);
- }
-
- close_local_interfaces (&aci_state);
-
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/nrf8001-helloworld.h b/peripheral/libupm/examples/c++/nrf8001-helloworld.h
deleted file mode 100644
index ec566b5..0000000
--- a/peripheral/libupm/examples/c++/nrf8001-helloworld.h
+++ /dev/null
@@ -1,254 +0,0 @@
-#include "hal_platform.h"
-#include "aci.h"
-
-#pragma once
-
-#define SETUP_ID 0
-#define SETUP_FORMAT 2 /** nRF8001 Cx */
-#define ACI_DYNAMIC_DATA_SIZE 263
-
-/* Service: GATT - Characteristic: Service Changed - Pipe: TX_ACK */
-#define PIPE_GATT_SERVICE_CHANGED_TX_ACK 1
-#define PIPE_GATT_SERVICE_CHANGED_TX_ACK_MAX_SIZE 4
-
-/* Service: Device Information - Characteristic: Hardware Revision String - Pipe: SET */
-#define PIPE_DEVICE_INFORMATION_HARDWARE_REVISION_STRING_SET 2
-#define PIPE_DEVICE_INFORMATION_HARDWARE_REVISION_STRING_SET_MAX_SIZE 9
-
-/* Service: Device Information - Characteristic: Manufacturer Name String - Pipe: SET */
-#define PIPE_DEVICE_INFORMATION_MANUFACTURER_NAME_STRING_SET 3
-#define PIPE_DEVICE_INFORMATION_MANUFACTURER_NAME_STRING_SET_MAX_SIZE 20
-
-/* Service: Device Information - Characteristic: Model Number String - Pipe: SET */
-#define PIPE_DEVICE_INFORMATION_MODEL_NUMBER_STRING_SET 4
-#define PIPE_DEVICE_INFORMATION_MODEL_NUMBER_STRING_SET_MAX_SIZE 8
-
-/* Service: Device Information - Characteristic: Firmware Revision String - Pipe: SET */
-#define PIPE_DEVICE_INFORMATION_FIRMWARE_REVISION_STRING_SET 5
-#define PIPE_DEVICE_INFORMATION_FIRMWARE_REVISION_STRING_SET_MAX_SIZE 4
-
-/* Service: Device Information - Characteristic: PNP_ID - Pipe: SET */
-#define PIPE_DEVICE_INFORMATION_PNP_ID_SET 6
-#define PIPE_DEVICE_INFORMATION_PNP_ID_SET_MAX_SIZE 7
-
-/* Service: UART over BTLE - Characteristic: UART RX - Pipe: RX */
-#define PIPE_UART_OVER_BTLE_UART_RX_RX 7
-#define PIPE_UART_OVER_BTLE_UART_RX_RX_MAX_SIZE 20
-
-/* Service: UART over BTLE - Characteristic: UART TX - Pipe: TX */
-#define PIPE_UART_OVER_BTLE_UART_TX_TX 8
-#define PIPE_UART_OVER_BTLE_UART_TX_TX_MAX_SIZE 20
-
-/* Service: UART over BTLE - Characteristic: UART Control Point - Pipe: TX */
-#define PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_TX 9
-#define PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_TX_MAX_SIZE 9
-
-/* Service: UART over BTLE - Characteristic: UART Control Point - Pipe: RX */
-#define PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_RX 10
-#define PIPE_UART_OVER_BTLE_UART_CONTROL_POINT_RX_MAX_SIZE 9
-
-/* Service: UART over BTLE - Characteristic: UART Link Timing Current - Pipe: SET */
-#define PIPE_UART_OVER_BTLE_UART_LINK_TIMING_CURRENT_SET 11
-#define PIPE_UART_OVER_BTLE_UART_LINK_TIMING_CURRENT_SET_MAX_SIZE 6
-
-
-#define NUMBER_OF_PIPES 11
-
-#define SERVICES_PIPE_TYPE_MAPPING_CONTENT {\
- {ACI_STORE_LOCAL, ACI_TX_ACK}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
- {ACI_STORE_LOCAL, ACI_RX}, \
- {ACI_STORE_LOCAL, ACI_TX}, \
- {ACI_STORE_LOCAL, ACI_TX}, \
- {ACI_STORE_LOCAL, ACI_RX}, \
- {ACI_STORE_LOCAL, ACI_SET}, \
-}
-
-#define GAP_PPCP_MAX_CONN_INT 0x12 /**< Maximum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific value requested */
-#define GAP_PPCP_MIN_CONN_INT 0xa /**< Minimum connection interval as a multiple of 1.25 msec , 0xFFFF means no specific value requested */
-#define GAP_PPCP_SLAVE_LATENCY 0
-#define GAP_PPCP_CONN_TIMEOUT 0xa /** Connection Supervision timeout multiplier as a multiple of 10msec, 0xFFFF means no specific value requested */
-
-#define NB_SETUP_MESSAGES 30
-#define SETUP_MESSAGES_CONTENT {\
- {0x00,\
- {\
- 0x07,0x06,0x00,0x00,0x02,0x02,0x41,0xfe,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x0b,0x01,0x01,0x00,0x00,0x06,0x00,0x00,\
- 0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1e,0x06,0x10,0x1c,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x14,0x03,0x90,0x01,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x00,0x04,0x04,0x02,0x02,0x00,0x01,0x28,0x00,0x01,0x00,0x18,0x04,0x04,0x05,0x05,0x00,\
- 0x02,0x28,0x03,0x01,0x02,0x03,0x00,0x00,0x2a,0x04,0x04,0x14,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x1c,0x05,0x00,0x03,0x2a,0x00,0x01,0x48,0x65,0x6c,0x6c,0x6f,0x63,0x73,0x65,0x6d,0x69,\
- 0x2e,0x63,0x6f,0x6d,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x38,0x05,0x05,0x00,0x04,0x28,0x03,0x01,0x02,0x05,0x00,0x01,0x2a,0x06,0x04,0x03,0x02,\
- 0x00,0x05,0x2a,0x01,0x01,0x80,0x00,0x04,0x04,0x05,0x05,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x54,0x06,0x28,0x03,0x01,0x02,0x07,0x00,0x04,0x2a,0x06,0x04,0x09,0x08,0x00,0x07,0x2a,\
- 0x04,0x01,0x0a,0x00,0x12,0x00,0x00,0x00,0x0a,0x00,0x04,0x04,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x70,0x02,0x02,0x00,0x08,0x28,0x00,0x01,0x01,0x18,0x04,0x04,0x05,0x05,0x00,0x09,0x28,\
- 0x03,0x01,0x22,0x0a,0x00,0x05,0x2a,0x26,0x04,0x05,0x04,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0x8c,0x0a,0x2a,0x05,0x01,0x00,0x00,0x00,0x00,0x46,0x14,0x03,0x02,0x00,0x0b,0x29,0x02,\
- 0x01,0x00,0x00,0x04,0x04,0x02,0x02,0x00,0x0c,0x28,0x00,0x01,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0xa8,0x0a,0x18,0x04,0x04,0x05,0x05,0x00,0x0d,0x28,0x03,0x01,0x02,0x0e,0x00,0x27,0x2a,\
- 0x04,0x04,0x09,0x01,0x00,0x0e,0x2a,0x27,0x01,0x0a,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0xc4,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x05,0x05,0x00,0x0f,0x28,0x03,0x01,0x02,\
- 0x10,0x00,0x29,0x2a,0x04,0x04,0x14,0x02,0x00,0x10,0x2a,0x29,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0xe0,0x01,0x30,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x05,0x05,0x00,0x11,0x28,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x20,0xfc,0x03,0x01,0x02,0x12,0x00,0x24,0x2a,0x04,0x04,0x08,0x02,0x00,0x12,0x2a,0x24,0x01,\
- 0x31,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x05,0x05,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0x18,0x00,0x13,0x28,0x03,0x01,0x02,0x14,0x00,0x26,0x2a,0x04,0x04,0x04,0x02,0x00,0x14,\
- 0x2a,0x26,0x01,0x33,0x34,0x00,0x00,0x04,0x04,0x05,0x05,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0x34,0x15,0x28,0x03,0x01,0x02,0x16,0x00,0x50,0x2a,0x06,0x04,0x08,0x07,0x00,0x16,0x2a,\
- 0x50,0x01,0x02,0x00,0x00,0xaa,0xaa,0xcc,0xcc,0x04,0x04,0x10,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0x50,0x10,0x00,0x17,0x28,0x00,0x01,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,0xf3,\
- 0xa3,0xb5,0x01,0x00,0x40,0x6e,0x04,0x04,0x13,0x13,0x00,0x18,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0x6c,0x28,0x03,0x01,0x04,0x19,0x00,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,0xf3,\
- 0xa3,0xb5,0x02,0x00,0x40,0x6e,0x44,0x10,0x14,0x00,0x00,0x19,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0x88,0x00,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x13,0x13,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0xa4,0x1a,0x28,0x03,0x01,0x10,0x1b,0x00,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,\
- 0xf3,0xa3,0xb5,0x03,0x00,0x40,0x6e,0x14,0x00,0x14,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0xc0,0x1b,0x00,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x14,0x03,0x02,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0xdc,0x00,0x1c,0x29,0x02,0x01,0x00,0x00,0x04,0x04,0x13,0x13,0x00,0x1d,0x28,0x03,0x01,\
- 0x14,0x1e,0x00,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x21,0xf8,0xf3,0xa3,0xb5,0x04,0x00,0x40,0x6e,0x54,0x10,0x09,0x00,0x00,0x1e,0x00,0x04,0x02,\
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x14,0x03,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x22,0x14,0x02,0x00,0x1f,0x29,0x02,0x01,0x00,0x00,0x04,0x04,0x13,0x13,0x00,0x20,0x28,0x03,\
- 0x01,0x02,0x21,0x00,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,\
- },\
- },\
- {0x00,\
- {\
- 0x1b,0x06,0x22,0x30,0x93,0xf3,0xa3,0xb5,0x05,0x00,0x40,0x6e,0x06,0x04,0x07,0x06,0x00,0x21,0x00,0x05,\
- 0x02,0xff,0xff,0xff,0xff,0xff,0xff,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x40,0x00,0x2a,0x05,0x01,0x00,0x04,0x04,0x00,0x0a,0x00,0x0b,0x2a,0x27,0x01,0x00,0x80,0x04,\
- 0x00,0x0e,0x00,0x00,0x2a,0x29,0x01,0x00,0x80,0x04,0x00,0x10,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x40,0x1c,0x00,0x00,0x2a,0x24,0x01,0x00,0x80,0x04,0x00,0x12,0x00,0x00,0x2a,0x26,0x01,0x00,\
- 0x80,0x04,0x00,0x14,0x00,0x00,0x2a,0x50,0x01,0x00,0x80,0x04,\
- },\
- },\
- {0x00,\
- {\
- 0x1f,0x06,0x40,0x38,0x00,0x16,0x00,0x00,0x00,0x02,0x02,0x00,0x08,0x04,0x00,0x19,0x00,0x00,0x00,0x03,\
- 0x02,0x00,0x02,0x04,0x00,0x1b,0x00,0x1c,0x00,0x04,0x02,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x13,0x06,0x40,0x54,0x0a,0x04,0x00,0x1e,0x00,0x1f,0x00,0x05,0x02,0x00,0x80,0x04,0x00,0x21,0x00,0x00,\
- },\
- },\
- {0x00,\
- {\
- 0x13,0x06,0x50,0x00,0x9e,0xca,0xdc,0x24,0x0e,0xe5,0xa9,0xe0,0x93,0xf3,0xa3,0xb5,0x00,0x00,0x40,0x6e,\
- },\
- },\
- {0x00,\
- {\
- 0x06,0x06,0xf0,0x00,0x02,0xb2,0xd1,\
- },\
- },\
-}
diff --git a/peripheral/libupm/examples/c++/nunchuck.cxx b/peripheral/libupm/examples/c++/nunchuck.cxx
deleted file mode 100644
index 4b9d617..0000000
--- a/peripheral/libupm/examples/c++/nunchuck.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "nunchuck.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a nunchuck controller bus 0
- upm::NUNCHUCK *nunchuck = new upm::NUNCHUCK(0);
-
- // always do this first
- cout << "Initializing... " << endl;
- if (!nunchuck->init())
- {
- cerr << "nunchuck->init() failed." << endl;
- return 0;
- }
-
- while (shouldRun)
- {
- nunchuck->update();
-
- cout << "stickX: " << nunchuck->stickX
- << ", stickY: " << nunchuck->stickY << endl;
- cout << "accelX: " << nunchuck->accelX
- << ", accelY: " << nunchuck->accelY
- << ", accelZ: " << nunchuck->accelZ << endl;
-
- cout << "button C: "
- << ((nunchuck->buttonC) ? "pressed" : "not pressed") << endl;
- cout << "button Z: "
- << ((nunchuck->buttonZ) ? "pressed" : "not pressed") << endl;
- cout << endl;
-
- usleep(100000);
- }
- //! [Interesting]
-
- delete nunchuck;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/otp538u.cxx b/peripheral/libupm/examples/c++/otp538u.cxx
deleted file mode 100644
index ea6e3b3..0000000
--- a/peripheral/libupm/examples/c++/otp538u.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <iomanip>
-#include <signal.h>
-#include "otp538u.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-// analog voltage, usually 3.3 or 5.0
-#define OTP538U_AREF 5.0
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a OTP538U on analog pins A0 and A1
- // A0 is used for the Ambient Temperature and A1 is used for the
- // Object temperature.
- upm::OTP538U *temps = new upm::OTP538U(0, 1, OTP538U_AREF);
-
- // Output ambient and object temperatures
- while (shouldRun)
- {
- cout << "Ambient temp: " << std::fixed << setprecision(2)
- << temps->ambientTemperature()
- << " C, Object temp: " << temps->objectTemperature()
- << " C" << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete temps;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ozw.cxx b/peripheral/libupm/examples/c++/ozw.cxx
deleted file mode 100644
index 40c30f4..0000000
--- a/peripheral/libupm/examples/c++/ozw.cxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-
-#include "ozw.h"
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
-
- string defaultDev = "/dev/ttyACM0";
-
- // if an argument was specified, use it as the device instead
- if (argc > 1)
- defaultDev = string(argv[1]);
-
- // Instantiate an OZW instance
- upm::OZW *sensor = new upm::OZW();
-
- // The first thing to do is create options, then lock them when done.
- sensor->optionsCreate();
- sensor->optionsLock();
-
- // Next, initialize it.
- cout << "Initializing, this may take awhile depending on your ZWave network"
- << endl;
-
- if (!sensor->init(defaultDev))
- {
- cerr << "Init failed." << endl;
- return 0;
- }
- cout << "Initialization complete" << endl;
-
- cout << "Dumping nodes..." << endl;
-
- sensor->dumpNodes();
-
- // The following is example output of dumpNodes:
- //
- // Dumping nodes...
- // Node 1: Z-Stick Gen5
- // Node 2: Smart Switch 6
- // Index: 0, Type: bool, Label: Switch, Value: False
- // Index: 2, Type: float, Label: Energy, Value: 1.190 kWh
- // Index: 3, Type: float, Label: Previous Reading, Value: 1.190 kWh
- // Index: 4, Type: int32, Label: Interval, Value: 1521 seconds
- // Index: 5, Type: float, Label: Power, Value: 0.000 W
- // Index: 6, Type: float, Label: Voltage, Value: 121.256 V
- // Index: 7, Type: float, Label: Current, Value: 0.000 A
- // Index: 8, Type: bool, Label: Exporting, Value: False
- // Index: 45, Type: list, Label: Day, Value: Friday
- // Index: 46, Type: byte, Label: Hour, Value: 5
- // Index: 47, Type: byte, Label: Minute, Value: 53
- // Node 3: Multi Sensor
- // Index: 0, Type: bool, Label: Sensor, Value: True
- // Index: 1, Type: float, Label: Temperature, Value: 72.8 F
- // Index: 2, Type: float, Label: Luminance, Value: 4 lux
- // Index: 3, Type: float, Label: Relative Humidity, Value: 22 %
- // Index: 17, Type: byte, Label: Battery Level, Value: 98 %
- // Node 5: Minimote
- // Node 6: Smart Energy Switch
- // Index: 0, Type: bool, Label: Switch, Value: False
- // Index: 2, Type: float, Label: Power, Value: 0.000 W
- // Index: 3, Type: float, Label: Energy, Value: 1.609 kWh
- // Index: 4, Type: float, Label: Previous Reading, Value: 1.609 kWh
- // Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
- // Index: 6, Type: float, Label: Power, Value: 0.000 W
- // Index: 7, Type: float, Label: Previous Reading, Value: 1.609 W
- // Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
- // Index: 9, Type: bool, Label: Exporting, Value: False
- // Node 7: Smart Energy Switch
- // Index: 0, Type: bool, Label: Switch, Value: False
- // Index: 2, Type: float, Label: Power, Value: 0.000 W
- // Index: 3, Type: float, Label: Energy, Value: 0.000 kWh
- // Index: 4, Type: float, Label: Previous Reading, Value: 0.000 kWh
- // Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
- // Index: 6, Type: float, Label: Power, Value: 0.000 W
- // Index: 7, Type: float, Label: Previous Reading, Value: 0.000 W
- // Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
- // Index: 9, Type: bool, Label: Exporting, Value: False
- //
- // So, with the above in mind:
- //
- // 1. Query the temperature on node 3 and print it out (as a
- // string), along with the units of measure:
- //
- // cout << "Temperature: " << sensor->getValueAsString(3, 1)
- // << " " << sensor->getValueUnits(3, 1) << endl;
- //
- // 2. query the same temperature as a float:
- //
- // float temperature = sensor->getValueAsFloat(3, 1);
- //
- // 3. Turn on the light plugged into the switch on Node 7, wait 5
- // seconds, then turn it back off again:
- //
- // cout << "Turning ON node 7" << endl;
- // sensor->setValueAsBool(7, 0, true);
- //
- // cout << "Sleeping for 5 seconds" << endl;
- // sleep(5);
- //
- // cout << "Turning OFF node 7" << endl;
- // sensor->setValueAsBool(7, 0, false);
-
-
-//! [Interesting]
-
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/pca9685.cxx b/peripheral/libupm/examples/c++/pca9685.cxx
deleted file mode 100644
index 0806e40..0000000
--- a/peripheral/libupm/examples/c++/pca9685.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "pca9685.h"
-
-using namespace std;
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an PCA9685 on I2C bus 0
-
- upm::PCA9685 *leds = new upm::PCA9685(PCA9685_I2C_BUS,
- PCA9685_DEFAULT_I2C_ADDR);
-
- // put device to sleep
- leds->setModeSleep(true);
-
- // setup a period of 50Hz
- leds->setPrescaleFromHz(50);
-
- // wake device up
- leds->setModeSleep(false);
-
- // Setup a 50% duty cycle -- on time at 0, off time at 2048 (4096 / 2)
- // Set for all channels
-
- leds->ledOnTime(PCA9685_ALL_LED, 0);
- leds->ledOffTime(PCA9685_ALL_LED, 2048);
-
- // but, turn channel 3 full off and channel 4 full on
-
- cout << "Turning channel 3 off, and channel 4 on." << endl;
- cout << "All other channels will be PWM'd at a 50% duty cycle." << endl;
-
- leds->ledFullOff(3, true);
- leds->ledFullOn(4, true);
-
- // now, just sleep for 5 seconds, reset channels 3 and 4, and exit.
- cout << "Sleeping for 5 seconds..." << endl;
-
- sleep(5);
-
- cout << "Exiting..." << endl;
-
- // clear the bits we set earlier
- leds->ledFullOff(3, false);
- leds->ledFullOn(4, false);
-
-//! [Interesting]
-
- delete leds;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/pn532-writeurl.cxx b/peripheral/libupm/examples/c++/pn532-writeurl.cxx
deleted file mode 100644
index f7fc956..0000000
--- a/peripheral/libupm/examples/c++/pn532-writeurl.cxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "pn532.h"
-
-using namespace std;
-
-// the URL we want to add as an NDEF record
-// NOTE: this cannot exceed 34 characters.
-static char url[] = "iotdk.intel.com";
-
-
-int main(int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
- // IRQ, and gpio 2 for the reset pin.
-
- upm::PN532 *nfc = new upm::PN532(3, 2);
-
- if (!nfc->init())
- cerr << "init() failed" << endl;
-
- uint32_t vers = nfc->getFirmwareVersion();
-
- if (vers)
- printf("Got firmware version: 0x%08x\n", vers);
- else
- {
- printf("Could not identify PN532\n");
- return 1;
- }
-
- // Now scan and identify any cards that come in range (1 for now)
-
- // Retry forever
- nfc->setPassiveActivationRetries(0xff);
-
- nfc->SAMConfig();
-
- uint8_t uidSize;
- uint8_t uid[7];
-
- bool foundCard = false;
- while (!foundCard)
- {
- memset(uid, 0, 7);
- if (nfc->readPassiveTargetID(nfc->BAUD_MIFARE_ISO14443A,
- uid, &uidSize, 2000))
- {
- // found a card
- printf("Found a card: UID len %d\n", uidSize);
- printf("UID: ");
- for (int i = 0; i < uidSize; i++)
- printf("%02x ", uid[i]);
- printf("\n");
- printf("SAK: 0x%02x\n", nfc->getSAK());
- printf("ATQA: 0x%04x\n\n", nfc->getATQA());
- foundCard = true;
- }
- else
- {
- printf("Waiting for a card...\n");
- }
- }
-
- if (uidSize != 7)
- {
- printf("This example will only write an NDEF URI to preformatted\n");
- printf("Mifare Ultralight or NTAG2XX tags\n");
-
- return 1;
- }
-
- // 48 bytes is maximum data area on ultralight cards, so we use that
- // as the maximum datasize here. Obviously if you have a bigger
- // card, you can write more data.
- if (!nfc->ntag2xx_WriteNDEFURI(nfc->NDEF_URIPREFIX_HTTP, url, 48))
- {
- // failure
- printf("Failed to write NDEF record tag.\n");
- return 1;
- }
-
- printf("Success, URL record written to tag.\n");
-
-
-//! [Interesting]
-
- delete nfc;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/pn532.cxx b/peripheral/libupm/examples/c++/pn532.cxx
deleted file mode 100644
index d1b7ba0..0000000
--- a/peripheral/libupm/examples/c++/pn532.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-#include "pn532.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
- // IRQ, and gpio 2 for the reset pin.
-
- upm::PN532 *nfc = new upm::PN532(3, 2);
-
- if (!nfc->init())
- cerr << "init() failed" << endl;
-
- uint32_t vers = nfc->getFirmwareVersion();
-
- if (vers)
- printf("Got firmware version: 0x%08x\n", vers);
- else
- {
- printf("Could not identify PN532\n");
- return 1;
- }
-
- // Now scan and identify any cards that come in range (1 for now)
-
- // Retry forever
- nfc->setPassiveActivationRetries(0xff);
-
- nfc->SAMConfig();
-
- uint8_t uidSize;
- uint8_t uid[7];
-
- while (shouldRun)
- {
- memset(uid, 0, 7);
- if (nfc->readPassiveTargetID(nfc->BAUD_MIFARE_ISO14443A,
- uid, &uidSize, 2000))
- {
- // found a card
- printf("Found a card: UID len %d\n", uidSize);
- printf("UID: ");
- for (int i = 0; i < uidSize; i++)
- printf("%02x ", uid[i]);
- printf("\n");
- printf("SAK: 0x%02x\n", nfc->getSAK());
- printf("ATQA: 0x%04x\n\n", nfc->getATQA());
- sleep(1);
- }
- else
- {
- printf("Waiting for a card...\n");
- }
- }
-
-
-//! [Interesting]
-
- delete nfc;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ppd42ns.cxx b/peripheral/libupm/examples/c++/ppd42ns.cxx
deleted file mode 100644
index 38a64e5..0000000
--- a/peripheral/libupm/examples/c++/ppd42ns.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "ppd42ns.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a dust sensor on GPIO pin D8
- upm::PPD42NS* dust = new upm::PPD42NS(8);
- upm::dustData data;
- cout << "This program will give readings every 30 seconds until you stop it" << endl;
- while (shouldRun)
- {
- data = dust->getData();
- cout << "Low pulse occupancy: " << data.lowPulseOccupancy << endl;
- cout << "Ratio: " << data.ratio << endl;
- cout << "Concentration: " << data.concentration << endl;
- }
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete dust;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/pulsensor.cxx b/peripheral/libupm/examples/c++/pulsensor.cxx
deleted file mode 100644
index dcb9cba..0000000
--- a/peripheral/libupm/examples/c++/pulsensor.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include "pulsensor.h"
-#include <signal.h>
-
-using namespace upm;
-
-int doWork = 0;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-void
-handler (clbk_data data) {
- printf ("callback data (%d)\n", data);
-}
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- Pulsensor *sensor = new Pulsensor(handler);
-
- sensor->start_sampler();
- while (!doWork) {
- usleep (5);
- }
- sensor->stop_sampler();
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rfr359f.cxx b/peripheral/libupm/examples/c++/rfr359f.cxx
deleted file mode 100644
index b7a8c21..0000000
--- a/peripheral/libupm/examples/c++/rfr359f.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "rfr359f.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate an RFR359F digital pin D2
- // This was tested on the Grove IR Distance Interrupter
-
- upm::RFR359F* dInterruptor = new upm::RFR359F(2);
-
- // The range appears to be about 4 inches, depending on adjustment
- while (shouldRun)
- {
- if (dInterruptor->objectDetected())
- cout << "Object detected" << endl;
- else
- cout << "Area is clear" << endl;
-
- usleep(100000); // 100ms
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete dInterruptor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rgbringcoder.cxx b/peripheral/libupm/examples/c++/rgbringcoder.cxx
deleted file mode 100644
index 52644cd..0000000
--- a/peripheral/libupm/examples/c++/rgbringcoder.cxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "rgbringcoder.h"
-#include <signal.h>
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
- //! [Interesting]
-
- // There are a lot of pins to hook up. These pins are valid for the
- // Edison board, but may need to be adjusted for other platforms.
-
- // In order:
- // enable - 4
- // latch - 10
- // clear - 11
- // clock - 2
- // data - 9
- // switch - 7
-
- // red pwm - 3
- // green pwm - 5
- // blue pwm - 6
-
- // encA - 12
- // encB - 13
-
- upm::RGBRingCoder *ringCoder =
- new upm::RGBRingCoder(4, 10, 11, 2, 9, 7, 12, 13, 3, 5, 6);
-
- uint16_t spin = 0x0001;
- bool oldState = false;
- int oldPos = 0;
-
- // Lets go green
- ringCoder->setRGBLED(0.99, 0.01, 0.99);
-
- while (shouldRun)
- {
- // you spin me round...
- if (spin == 0)
- spin = 0x0001;
-
- ringCoder->setRingLEDS(spin);
- spin <<= 1;
-
- // check button state
- bool bstate = ringCoder->getButtonState();
- if (bstate != oldState)
- {
- cout << "Button state changed from " << oldState << " to "
- << bstate << endl;
- oldState = bstate;
- }
-
- // check encoder position
- int epos = ringCoder->getEncoderPosition();
- if (epos != oldPos)
- {
- cout << "Encoder position changed from " << oldPos << " to "
- << epos << endl;
- oldPos = epos;
- }
-
- usleep(100000);
- }
-
- //! [Interesting]
-
- delete ringCoder;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rhusb.cxx b/peripheral/libupm/examples/c++/rhusb.cxx
deleted file mode 100644
index 20f12ed..0000000
--- a/peripheral/libupm/examples/c++/rhusb.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "rhusb.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- string defaultDev = "/dev/ttyUSB0";
-
- // if an argument was specified, use it as the device instead
- if (argc > 1)
- defaultDev = string(argv[1]);
-
- cout << "Using device " << defaultDev << endl;
- cout << "Initializing..." << endl;
-
- // Instantiate an RHUSB instance on defaultDev
- upm::RHUSB sensor(defaultDev);
-
- // output the firmware ID
- cout << "Firmware ID: " << sensor.getFirmwareID() << endl;
- cout << endl;
-
- // update and print available values every second
- while (shouldRun)
- {
- // update our values from the sensor
- sensor.update();
-
- // we show both C and F for temperature
- cout << "Temperature: " << sensor.getTemperature()
- << " C / " << sensor.getTemperature(true) << " F"
- << endl;
-
- cout << "Humidity: " << sensor.getHumidity()
- << " %" << endl;
-
- cout << endl;
-
- sleep(1);
- }
-
-
- cout << "Exiting..." << endl;
-
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rotaryencoder.cxx b/peripheral/libupm/examples/c++/rotaryencoder.cxx
deleted file mode 100644
index f6c505e..0000000
--- a/peripheral/libupm/examples/c++/rotaryencoder.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "rotaryencoder.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Grove Rotary Encoder, using signal pins D2 and D3
- upm::RotaryEncoder* rotaryencoder = new upm::RotaryEncoder(2, 3);
-
- while (shouldRun)
- {
- cout << "Position: " << rotaryencoder->position() << endl;
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete rotaryencoder;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rpr220-intr.cxx b/peripheral/libupm/examples/c++/rpr220-intr.cxx
deleted file mode 100644
index 05a8381..0000000
--- a/peripheral/libupm/examples/c++/rpr220-intr.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "rpr220.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-volatile unsigned int counter = 0;
-
-// Our interrupt handler
-void rprISR(void *arg)
-{
- counter++;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // This example uses an interrupt handler to increment a counter
-
- // Instantiate an RPR220 digital pin D2
- // This was tested on the Grove IR Reflective Sensor
-
- upm::RPR220* rpr220 = new upm::RPR220(2);
-
- // Here, we setup our Interupt Service Routine (ISR) to count
- // 'black' pulses detected.
-
- rpr220->installISR(rprISR, NULL);
-
- while (shouldRun)
- {
- cout << "Counter: " << counter << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete rpr220;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/rpr220.cxx b/peripheral/libupm/examples/c++/rpr220.cxx
deleted file mode 100644
index c9bdf1d..0000000
--- a/peripheral/libupm/examples/c++/rpr220.cxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "rpr220.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // This example uses a simple method to determine current status
-
- // Instantiate an RPR220 digital pin D2
- // This was tested on the Grove IR Reflective Sensor
-
- upm::RPR220* rpr220 = new upm::RPR220(2);
-
- while (shouldRun)
- {
- if (rpr220->blackDetected())
- cout << "Black detected" << endl;
- else
- cout << "Black NOT detected" << endl;
-
- usleep(100000); // 100ms
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete rpr220;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/sainsmartks.cxx b/peripheral/libupm/examples/c++/sainsmartks.cxx
deleted file mode 100644
index 19c8704..0000000
--- a/peripheral/libupm/examples/c++/sainsmartks.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <iostream>
-
-#include "sainsmartks.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // use default pins
- upm::SAINSMARTKS* lcd = new upm::SAINSMARTKS();
- lcd->setCursor(0,0);
- lcd->write("Sainsmart KS");
- lcd->setCursor(1,2);
- lcd->write("Hello World");
-
- // output current key value every second.
- while (shouldRun)
- {
- cout << "Button value: " << lcd->getRawKeyValue() << endl;
- sleep(1);
- }
-
-//! [Interesting]
-
- delete lcd;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/si114x.cxx b/peripheral/libupm/examples/c++/si114x.cxx
deleted file mode 100644
index 4c069c9..0000000
--- a/peripheral/libupm/examples/c++/si114x.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "si114x.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a SI114x UV Sensor on I2C bus 0
- upm::SI114X* uvi = new upm::SI114X(0);
-
- // First initialize it
- uvi->initialize();
-
- cout << "UV Index Scale:" << endl;
- cout << "---------------" << endl;
- cout << "11+ Extreme" << endl;
- cout << "8-10 Very High" << endl;
- cout << "6-7 High" << endl;
- cout << "3-5 Moderate" << endl;
- cout << "0-2 Low" << endl;
- cout << endl;
-
- // update every second and print the currently measured UV Index
- while (shouldRun)
- {
- // update current value(s)
- uvi->update();
-
- // print detected value
- cout << "UV Index: " << uvi->getUVIndex() << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete uvi;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/sm130.cxx b/peripheral/libupm/examples/c++/sm130.cxx
deleted file mode 100644
index 3d1e3bd..0000000
--- a/peripheral/libupm/examples/c++/sm130.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <string>
-#include <signal.h>
-#include <stdio.h>
-#include "sm130.h"
-
-using namespace std;
-using namespace upm;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
-
- // Instantiate a UART based SM130 RFID Module using defaults
- upm::SM130* sensor = new upm::SM130();
-
- // set the baud rate. 19200 baud is the default.
- if (sensor->setBaudRate(19200))
- {
- cerr << "Failed to set baud rate" << endl;
- return 1;
- }
-
- cout << "Resetting..." << endl;
- sensor->reset();
-
- cout << "Firmware revision: " << sensor->getFirmwareVersion() << endl;
-
- cout << "Waiting up to 5 seconds for a tag..." << endl;
-
- if (sensor->waitForTag(5000))
- {
- cout << "Found tag, UID: "
- << sensor->string2HexString(sensor->getUID()) << endl;
- cout << "Tag Type: " << sensor->tag2String(sensor->getTagType())
- << endl;
- }
- else
- {
- // error
- cout << "waitForTag failed: " << sensor->getLastErrorString() << endl;
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ssd1306-oled.cxx b/peripheral/libupm/examples/c++/ssd1306-oled.cxx
deleted file mode 100644
index 07421e3..0000000
--- a/peripheral/libupm/examples/c++/ssd1306-oled.cxx
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Author Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Adapted from ssd1308 library.
- * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "ssd1306.h"
-
-#define DEVICE_ADDRESS 0x3C
-#define BUS_NUMBER 0x6
-
-static uint8_t intel_logo[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224,
- 224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, 60,
- 62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31,
- 30, 62, 62, 62, 62, 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240,
- 224, 224, 224, 192, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195,
- 195, 7, 15, 15, 63, 127, 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 192, 192, 240, 248, 124, 124, 60, 0, 0, 0, 0, 159, 159,
- 159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0,
- 0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
- 128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128,
- 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
- 0, 0, 0, 0, 3, 7, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255,
- 255, 255, 0, 0, 224, 248, 252, 252, 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0,
- 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, 255, 255,
- 255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
- 15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143,
- 135, 135, 143, 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255,
- 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
- 224, 248, 248, 255, 255, 255, 255, 255, 127, 15, 255, 255, 255, 255, 255,
- 255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
- 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0,
- 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255,
- 255, 255, 255, 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231,
- 231, 231, 199, 135, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0,
- 0, 0, 224, 240, 248, 248, 252, 254, 255, 255, 255, 127, 63, 63, 31, 15, 7,
- 7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, 240, 192, 192, 128, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
- 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7,
- 7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7,
- 7, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15,
- 31, 127, 127, 127, 255, 255, 252, 252, 252, 248, 240, 240, 240, 224, 224,
- 224, 192, 192, 192, 192, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192,
- 224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, 252,
- 254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 3, 3, 3, 7, 7, 7, 15, 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127,
- 127, 127, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254,
- 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
- 255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127,
- 63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, 3, 3,
- 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0
- };
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- upm::SSD1306 *lcd = new upm::SSD1306(BUS_NUMBER, DEVICE_ADDRESS);
-
- lcd->clear();
- lcd->stopscroll();
- lcd->draw(intel_logo, 1024);
-
- sleep(3);
-
- lcd->clear();
- lcd->setCursor(2, 0);
- lcd->write("Hello");
- lcd->setCursor(3,0);
- lcd->write("World");
-
- sleep(3);
-
- lcd->invert(true);
-
- sleep(3);
-
- lcd->dim(true);
-
- sleep(3);
-
- lcd->dim(false);
-
- sleep(3);
-
- lcd->invert(false);
- lcd->startscrollright(0x00, 0x0F);
-
- sleep(5);
-
- lcd->stopscroll();
- lcd->startscrollleft(0x00, 0x0F);
-
- sleep(5);
-
- lcd->stopscroll();
- lcd->startscrolldiagleft(0x00,0x0F);
-
- sleep(5);
-
- lcd->stopscroll();
- lcd->startscrolldiagright(0x00,0x0F);
-
- sleep(5);
-
- lcd->stopscroll();
-
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ssd1308-oled.cxx b/peripheral/libupm/examples/c++/ssd1308-oled.cxx
deleted file mode 100644
index f54169e..0000000
--- a/peripheral/libupm/examples/c++/ssd1308-oled.cxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "ssd1308.h"
-
-#define DEVICE_ADDRESS 0x3C
-#define BUS_NUMBER 0x0
-
-static uint8_t intel_logo[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224,
- 224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, 60,
- 62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31,
- 30, 62, 62, 62, 62, 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240,
- 224, 224, 224, 192, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195,
- 195, 7, 15, 15, 63, 127, 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 192, 192, 240, 248, 124, 124, 60, 0, 0, 0, 0, 159, 159,
- 159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0,
- 0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
- 128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128,
- 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
- 0, 0, 0, 0, 3, 7, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255,
- 255, 255, 0, 0, 224, 248, 252, 252, 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0,
- 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, 255, 255,
- 255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
- 15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143,
- 135, 135, 143, 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255,
- 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
- 224, 248, 248, 255, 255, 255, 255, 255, 127, 15, 255, 255, 255, 255, 255,
- 255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
- 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0,
- 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255,
- 255, 255, 255, 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231,
- 231, 231, 199, 135, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0,
- 0, 0, 224, 240, 248, 248, 252, 254, 255, 255, 255, 127, 63, 63, 31, 15, 7,
- 7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, 240, 192, 192, 128, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
- 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7,
- 7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7,
- 7, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15,
- 31, 127, 127, 127, 255, 255, 252, 252, 252, 248, 240, 240, 240, 224, 224,
- 224, 192, 192, 192, 192, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192,
- 224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, 252,
- 254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 3, 3, 3, 7, 7, 7, 15, 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127,
- 127, 127, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254,
- 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
- 255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127,
- 63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, 3, 3,
- 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0 };
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- upm::SSD1308 *lcd = new upm::SSD1308(BUS_NUMBER, DEVICE_ADDRESS);
-
- lcd->clear();
- lcd->draw(intel_logo, 1024);
-
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ssd1327-oled.cxx b/peripheral/libupm/examples/c++/ssd1327-oled.cxx
deleted file mode 100644
index 73323ec..0000000
--- a/peripheral/libupm/examples/c++/ssd1327-oled.cxx
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Author: Yevgeniy Kiveish <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "ssd1327.h"
-
-#define DEVICE_ADDRESS 0x3C
-#define BUS_NUMBER 0x0
-
-static uint8_t SeeedLogo[] ={
-0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xC0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
-0x07, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0F, 0x80, 0x01, 0xE0,
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
-0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
-0x0F, 0x80, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x01, 0xE0,
-0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x0F, 0x80, 0x03, 0xE0, 0x78, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1E, 0x07, 0x80, 0x03, 0xE0, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
-0x07, 0x80, 0x03, 0xE0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x07, 0x80, 0x03, 0xC1,
-0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x87, 0xC0, 0x07, 0xC1, 0xF0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x0F, 0x83, 0xC0, 0x07, 0x83, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
-0xC3, 0xC0, 0x07, 0x87, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE1, 0xE0, 0x07, 0x0F,
-0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0xE0, 0x0F, 0x0F, 0x80, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0xF8, 0xF0, 0x0E, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-0xF8, 0x70, 0x1C, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x18, 0x7E,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x18, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1F, 0x88, 0x21, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0F, 0xC4, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xE0, 0x0F, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06,
-0x00, 0x00, 0x60, 0x00, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xDF, 0xE1, 0x9F, 0xEC, 0x7E,
-0xE6, 0x73, 0x9C, 0xE7, 0x39, 0xCE, 0x1C, 0xDF, 0xE1, 0xB9, 0xEC, 0xE7, 0xE0, 0x61, 0xD8, 0x66,
-0x1B, 0x86, 0x1C, 0x06, 0x61, 0xB0, 0x6D, 0xC3, 0x7C, 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x0F, 0x86,
-0x61, 0xB0, 0x6D, 0x83, 0x3E, 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x07, 0xC6, 0x61, 0xB0, 0x6D, 0x83,
-0xC3, 0x61, 0x18, 0x46, 0x03, 0x86, 0x18, 0x66, 0x61, 0xB0, 0x6D, 0xC3, 0xFE, 0x7F, 0x9F, 0xE7,
-0xF9, 0xFE, 0x1F, 0xE6, 0x3F, 0x9F, 0xEC, 0xFE, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xC6,
-0x3F, 0x9F, 0xEC, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00,
-0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x20, 0x82, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0xF3, 0xCF, 0x70, 0x9E, 0x79, 0xE7, 0x80, 0x00, 0x00,
-0x00, 0x00, 0x7D, 0x9E, 0x68, 0x20, 0xB2, 0xC8, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9E,
-0x6F, 0x20, 0xB2, 0xF9, 0xE7, 0x80, 0x00, 0x00, 0x00, 0x00, 0x46, 0x9A, 0x61, 0x20, 0xB2, 0xCB,
-0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xF3, 0xCF, 0x30, 0x9E, 0x79, 0xE7, 0x90, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x02, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00,
-0xF8, 0x00, 0x00, 0x40, 0x40, 0x02, 0x00, 0x00, 0x83, 0x60, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x40,
-0x60, 0xB7, 0x79, 0xE7, 0x81, 0xC7, 0x92, 0x70, 0x89, 0xE7, 0x9E, 0x78, 0x7C, 0xE2, 0xC9, 0x2C,
-0x81, 0xCC, 0xD2, 0x40, 0xFB, 0x21, 0xB2, 0x48, 0x40, 0x62, 0xF9, 0x2C, 0x80, 0x8C, 0xD2, 0x40,
-0x8B, 0xE7, 0xB0, 0x48, 0x40, 0xE2, 0xC9, 0x2C, 0x80, 0x84, 0xD2, 0x40, 0x8B, 0x2D, 0x92, 0x48,
-0x7D, 0xB3, 0x79, 0x27, 0x80, 0x87, 0x9E, 0x40, 0x8D, 0xE7, 0x9E, 0x48, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- upm::SSD1327 *lcd = new upm::SSD1327(BUS_NUMBER, 0x3C);
-
- // If you don't set the display to be white, the seeed logo will appear jagged
- lcd->setGrayLevel(12);
- lcd->draw(SeeedLogo, 96 * 96 / 8);
-
- // Simple print hello world
- for (uint8_t i = 0; i < 12; i++)
- {
- lcd->setCursor(i, 0);
- lcd->setGrayLevel(i);
- lcd->write("Hello World");
- }
-
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ssd1351.cxx b/peripheral/libupm/examples/c++/ssd1351.cxx
deleted file mode 100644
index c0de509..0000000
--- a/peripheral/libupm/examples/c++/ssd1351.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "mraa.hpp"
-#include <iostream>
-#include <unistd.h>
-
-#include "ssd1351.h"
-
-#define BLACK 0x0000
-#define WHITE 0xFFFF
-#define INTEL_BLUE 0x0BF8
-
-int main(int argc, char **argv)
-{
- // Define colors (16-bit RGB on 5/6/5 bits)
- int colors[] = {0x0000, 0x000F, 0x03E0, 0x03EF,
- 0x7800, 0x780F, 0x7BE0, 0xC618,
- 0x7BEF, 0x001F, 0x07E0, 0x07FF,
- 0xF800, 0xF81F, 0xFFE0, 0xFFFF};
-//! [Interesting]
- // Initialize display with pins
- // oc = 0, dc = 1, r = 2, si = 11, cl = 13
- upm::SSD1351* display = new upm::SSD1351(0, 1, 2);
-
- // Test lines pixel by pixel
- for(int i = 0; i < SSD1351HEIGHT; i++) {
- for(int j = 0; j < SSD1351WIDTH; j++) {
- display->drawPixel(i, j, colors[i/8]);
- }
- }
- display->refresh();
- sleep(5);
-
- // Test rectangles
- for(int i = 0; i < SSD1351HEIGHT/32; i++) {
- for (int j = 0; j < SSD1351WIDTH/32; j++) {
- display->fillRect(i * 32, j * 32, 32, 32, colors[i * 4 + j]);
- }
- }
- display->refresh();
- sleep(5);
-
- // Test circles
- display->fillScreen(0x2104);
- for(int i = 0; i < SSD1351HEIGHT/32; i++) {
- for (int j = 0; j < SSD1351WIDTH/32; j++) {
- display->drawCircle(i * 32 + 15, j * 32 + 15, 15, colors[i * 4 + j]);
- }
- }
- display->refresh();
- sleep(5);
-
- // Test Text
- display->fillScreen(INTEL_BLUE);
- display->setTextColor(WHITE, INTEL_BLUE);
- display->setTextSize(4);
- display->setCursor(7, 30);
- display->print("Intel");
- display->setCursor(5, 70);
- display->print("IoTDK");
- display->refresh();
-//! [Interesting]
-}
diff --git a/peripheral/libupm/examples/c++/st7735.cxx b/peripheral/libupm/examples/c++/st7735.cxx
deleted file mode 100644
index 2c14d49..0000000
--- a/peripheral/libupm/examples/c++/st7735.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <iostream>
-#include "st7735.h"
-#include <signal.h>
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- upm::ST7735 * lcd = new upm::ST7735(7, 4, 9, 8);
- lcd->fillScreen (ST7735_RED);
- lcd->refresh ();
-
- lcd->fillScreen (ST7735_CYAN);
- lcd->refresh ();
-
- lcd->fillScreen (ST7735_BLACK);
- lcd->refresh ();
-
- lcd->drawLine(10, 10, 10, 100, ST7735_MAGENTA);
- lcd->drawLine(20, 20, 10, 100, ST7735_YELLOW);
- lcd->drawLine(30, 30, 50, 100, ST7735_WHITE);
- lcd->refresh ();
-
- lcd->drawPixel (20, 20, ST7735_GREEN);
- lcd->refresh ();
-
- lcd->drawTriangle (50, 50, 80, 80, 60, 90, ST7735_GREEN);
- lcd->refresh ();
-
- lcd->drawCircle (100, 110, 10, ST7735_BLUE);
- lcd->refresh ();
-
-
- lcd->setTextWrap(0x0);
-
- lcd->setCursor(0, 30);
- lcd->setTextColor(ST7735_RED, ST7735_RED);
- lcd->setTextSize(1);
- lcd->print("Hello World!");
-
- lcd->setCursor(10, 50);
- lcd->setTextColor(ST7735_RED, ST7735_YELLOW);
- lcd->setTextSize(2);
- lcd->print("BIG");
-
- lcd->refresh ();
-
- std::cout << "exiting application" << std::endl;
-
- delete lcd;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/stepmotor.cxx b/peripheral/libupm/examples/c++/stepmotor.cxx
deleted file mode 100644
index 9357d5d..0000000
--- a/peripheral/libupm/examples/c++/stepmotor.cxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Authors: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "stepmotor.h"
-
-using namespace std;
-
-int doWork = 1;
-upm::StepMotor *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 0;
- }
-}
-
-int
-main(int argc, char **argv)
-{
-//! [Interesting]
- sensor = new upm::StepMotor(2, 3);
-
- while (doWork) {
- cout << "1 Revolution forward and back at 60 rpm" << endl;
- sensor->setSpeed(60);
- sensor->stepForward(200);
- usleep(1000000);
- sensor->stepBackward(200);
- usleep(1000000);
-
- cout << "1 Revolution forward and back at 150 rpm" << endl;
- sensor->setSpeed(150);
- sensor->stepForward(200);
- usleep(1000000);
- sensor->stepBackward(200);
- usleep(1000000);
-
- cout << "1 Revolution forward and back at 300 rpm" << endl;
- sensor->setSpeed(300);
- sensor->stepForward(200);
- usleep (1000000);
- sensor->stepBackward(200);
- usleep (1000000);
- }
-
- delete sensor;
-//! [Interesting]
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/sx1276-fsk.cxx b/peripheral/libupm/examples/c++/sx1276-fsk.cxx
deleted file mode 100644
index f63d1bf..0000000
--- a/peripheral/libupm/examples/c++/sx1276-fsk.cxx
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <iostream>
-#include <signal.h>
-#include "sx1276.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
-
- cout << "Specify an argument to go into receive mode. Default is transmit"
- << endl;
-
- bool rx = false;
- if (argc > 1)
- rx = true;
-
- // Instantiate an SX1276 using default parameters
- upm::SX1276 *sensor = new upm::SX1276();
-
- // 915Mhz
- sensor->setChannel(915000000);
-
- // FSK configuration (rx and tx must be configured the same):
- // Tx output power = 14 dBm
- // FSK freq deviation = 25000 Hz
- // FSK bandwidth = 50000 bps
- // FSK AFC bandwidth = 83333 Hz
- // FSK datarate = 50000 bps
- // FSK preamble len = 5
- // FSK fixed length payload = false
- // FSK CRC check = true
- // FSK (rx) continuous Rx mode = false
-
- sensor->setTxConfig(sensor->MODEM_FSK, 14, 25000, 0,
- 50000, 0, 5, false, true, false, 0, false);
-
- sensor->setRxConfig(sensor->MODEM_FSK, 50000, 50000,
- 0, 83333, 5, 0, false, 0, true,
- false, 0, false, true);
-
- int count = 0;
- int buflen = 64;
- char buffer[buflen];
-
- while (shouldRun)
- {
- if (!rx)
- {
- snprintf(buffer, buflen, "Ping %d", count++);
- cout << "Sending..." << std::string(buffer) << endl;
- sensor->sendStr(string(buffer), 3000);
-
- sensor->setSleep();
- sleep(1);
- }
- else
- {
- // receiving
- cout << "Attempting to receive..." << endl;
- int rv;
- if (rv = sensor->setRx(3000))
- {
- cout << "setRx returned " << rv << endl;
- }
- else
- {
- cout << "Received Buffer: " << sensor->getRxBufferStr() << endl;
- }
-
- // go back to sleep when done
- sensor->setSleep();
- usleep(250000);
- }
-
-
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/sx1276-lora.cxx b/peripheral/libupm/examples/c++/sx1276-lora.cxx
deleted file mode 100644
index 7c45597..0000000
--- a/peripheral/libupm/examples/c++/sx1276-lora.cxx
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <iostream>
-#include <signal.h>
-#include "sx1276.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-//! [Interesting]
- cout << "Specify an argument to go into receive mode. Default is transmit"
- << endl;
-
- bool rx = false;
- if (argc > 1)
- rx = true;
-
- // Instantiate an SX1276 using default parameters
- upm::SX1276 *sensor = new upm::SX1276();
-
- // 915Mhz
- sensor->setChannel(915000000);
-
- // LORA configuration (rx and tx must be configured the same):
- // Tx output power = 14 dBm
- // LORA bandwidth = 125000 (can also be 250K and 500K)
- // LORA spreading factor = 7
- // LORA coding rate = 1 (4/5)
- // LORA preamble len = 8
- // LORA symbol timeout = 5
- // LORA fixed payload = false
- // LORA IQ inversion = false
- // LORA (rx) continuous Rx mode = true
-
- sensor->setTxConfig(sensor->MODEM_LORA, 14, 0, 125000,
- 7, 1, 8, false, true, false, 0, false);
-
- sensor->setRxConfig(sensor->MODEM_LORA, 125000, 7,
- 1, 0, 8, 5, false, 0, true, false, 0, false, true);
-
- int count = 0;
- int buflen = 64;
- char buffer[buflen];
-
- while (shouldRun)
- {
- if (!rx)
- {
- snprintf(buffer, buflen, "Ping %d", count++);
- cout << "Sending..." << std::string(buffer) << endl;
- sensor->sendStr(string(buffer), 3000);
- sensor->setSleep();
- sleep(1);
- }
- else
- {
- // receiving
- cout << "Attempting to receive..." << endl;
- int rv;
- if (rv = sensor->setRx(3000))
- {
- cout << "setRx returned " << rv << endl;
- }
- else
- {
- cout << "Received Buffer: " << sensor->getRxBufferStr() << endl;
- }
-
- // go back to sleep when done
- sensor->setSleep();
- usleep(5000);
- }
-
-
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/sx6119.cxx b/peripheral/libupm/examples/c++/sx6119.cxx
deleted file mode 100644
index 2608387..0000000
--- a/peripheral/libupm/examples/c++/sx6119.cxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "sx6119.h"
-
-using namespace std;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a SX6119 on digital pins 2 (power) and 3 (seek)
- // This example was tested on the Grove FM Receiver.
-
- upm::SX6119* radio = new upm::SX6119(2, 3);
-
- // if an argument was specified (any argument), seek to the next
- // station, else just toggle the power.
-
-
- cout << "Supply any argument to the command line to seek to the" << endl;
- cout << "next station." << endl;
- cout << "Running the example without an argument will toggle the" <<endl;
- cout << "power on or off." << endl;
-
- cout << endl;
-
- bool doSeek = false;
-
- if (argc > 1)
- doSeek = true;
-
- // depending on what was selected, do it
-
- if (doSeek)
- radio->seek();
- else
- radio->togglePower();
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete radio;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/t3311.cxx b/peripheral/libupm/examples/c++/t3311.cxx
deleted file mode 100644
index 1859dc6..0000000
--- a/peripheral/libupm/examples/c++/t3311.cxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-
-#include "t3311.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- string defaultDev = "/dev/ttyUSB0";
-
- // if an argument was specified, use it as the device instead
- if (argc > 1)
- defaultDev = string(argv[1]);
-
- cout << "Initializing..." << endl;
-
- // Instantiate an T3311 instance, using MODBUS slave address 1, and
- // default comm parameters (9600, 8, N, 2)
- upm::T3311 *sensor = new upm::T3311(defaultDev, 1);
-
- // output the serial number and firmware revision
- cout << "Serial Number: " << sensor->getSerialNumber() << endl;
- cout << "Firmware Revision: " << sensor->getFirmwareMajor()
- << "." << sensor->getFirmwareMinor() << endl;
- cout << endl;
-
- // update and print available values every second
- while (shouldRun)
- {
- // update our values from the sensor
- sensor->update();
-
- // we show both C and F for temperature
- cout << "Temperature: " << sensor->getTemperature()
- << " C / " << sensor->getTemperature(true) << " F"
- << endl;
-
- cout << "Humidity: " << sensor->getHumidity()
- << " %" << endl;
-
- // this value depends on the sensor configuration -- by default
- // it is the dew point temperature
- cout << "Computed Value: " << sensor->getComputedValue() << endl;
-
- // with FW revisions > 2.44, extended computed data is available
- if (sensor->extendedDataAvailable())
- {
- cout << "Dew Point Temperature: " << sensor->getDewPointTemperature()
- << " C / " << sensor->getDewPointTemperature(true) << " F"
- << endl;
-
- cout << "Absolute Humidity: " << sensor->getAbsoluteHumidity()
- << " g/m3" << endl;
-
- cout << "Specific Humidity: " << sensor->getSpecificHumidity()
- << " g/kg" << endl;
-
- cout << "Mixing Ratio: " << sensor->getMixingRatio()
- << " g/kg" << endl;
-
- cout << "Specific Enthalpy: " << sensor->getSpecificEnthalpy()
- << " kJ/kg" << endl;
- }
-
- cout << endl;
-
- sleep(1);
- }
-
- cout << "Exiting..." << endl;
-
- delete sensor;
-
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ta12200.cxx b/peripheral/libupm/examples/c++/ta12200.cxx
deleted file mode 100644
index 5f949a1..0000000
--- a/peripheral/libupm/examples/c++/ta12200.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "ta12200.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a TA12-200 sensor on analog pin A0
- upm::TA12200* electricity = new upm::TA12200(0);
-
- while (shouldRun)
- {
- unsigned int maxVal = electricity->highestValue();
- float current = electricity->milliAmps(maxVal);
-
- cout << "Max ADC Value: " << maxVal << ", current: " << current
- << "mA" << endl;
- usleep(100000);
- }
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete electricity;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/tcs3414cs.cxx b/peripheral/libupm/examples/c++/tcs3414cs.cxx
deleted file mode 100644
index 5e6376e..0000000
--- a/peripheral/libupm/examples/c++/tcs3414cs.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "tcs3414cs.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::TCS3414CS *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- upm::tcs3414sc_rgb_t rgb;
-
- // Instantiate the color sensor on I2C
- sensor = new upm::TCS3414CS ();
-
- // Print out the r, g, b, and clr value every 0.5 seconds
- while (!doWork) {
- sensor->readRGB (&rgb);
- std::cout << (int)rgb.r << ", " << (int)rgb.g << ", " << (int)rgb.b << ", " << rgb.clr << std::endl;
- usleep (500000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/th02.cxx b/peripheral/libupm/examples/c++/th02.cxx
deleted file mode 100644
index cce0367..0000000
--- a/peripheral/libupm/examples/c++/th02.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "th02.h"
-#include <signal.h>
-
-int doWork = 0;
-upm::TH02 *sensor = NULL;
-
-void
-sig_handler(int signo)
-{
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
-}
-
-int
-main(int argc, char **argv)
-{
- //! [Interesting]
- float temperature = 0.0;
- float humidity = 0.0;
- sensor = new upm::TH02 ();
-
- while (!doWork) {
- temperature = sensor->getTemperature ();
- humidity = sensor->getHumidity ();
- std::cout << "Temperature = " << temperature << ", Humidity = " << humidity << std::endl;
- usleep (500000);
- }
- //! [Interesting]
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/tm1637.cxx b/peripheral/libupm/examples/c++/tm1637.cxx
deleted file mode 100644
index 235ae50..0000000
--- a/peripheral/libupm/examples/c++/tm1637.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "tm1637.h"
-#include <signal.h>
-#include <unistd.h>
-#include <sstream>
-#include <time.h>
-
-using namespace std;
-using namespace upm;
-
-bool run = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- run = false;
-}
-
-int
-main(int argc, char** argv)
-{
- //! [Interesting]
- bool point = true;
- int timezone = -7; // Your UTC offset
- time_t rawtime;
- struct tm * gmt;
- char myTime[5];
-
- fprintf(stdout, "TM1637 Display Example\n");
- signal(SIGINT, sig_handler);
-
- TM1637 myDisplay = TM1637(0, 1); // TM1637 on pins 0 (clk) and 1 (dio)
- myDisplay.write(0x39, 0x09, 0x09); // Start a box using 7-segment encoding
- myDisplay.writeAt(3, ']'); // Finish box using writeAt function
- sleep(3); // Wait 3 seconds
-
- while(run)
- {
- time(&rawtime); // Update raw time
- gmt = gmtime(&rawtime); // Get current time
-
- int hour = (gmt) ? gmt->tm_hour : 0;
- int min = (gmt) ? gmt->tm_min : 0;
- // Format and store the time in 24 hour format
- snprintf(myTime, 5, "%2d%02d", (hour + timezone + 24) % 24, min);
-
- myDisplay.write(myTime); // Write to display as string
- myDisplay.setColon(point ^= true); // Toggle the dots on the display
- sleep(1); // Only update once every second
- }
-
- //! [Interesting]
- return 0;
-}
-
-
diff --git a/peripheral/libupm/examples/c++/tp401.cxx b/peripheral/libupm/examples/c++/tp401.cxx
deleted file mode 100644
index 255d3f0..0000000
--- a/peripheral/libupm/examples/c++/tp401.cxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include <unistd.h>
-#include <iostream>
-#include "tp401.h"
-
-using namespace std;
-
-//! [Interesting]
-// Give a qualitative meaning to the value from the sensor
-std::string
-airQuality(uint16_t value)
-{
- if(value < 50) return "Fresh Air";
- if(value < 200) return "Normal Indoor Air";
- if(value < 400) return "Low Pollution";
- if(value < 600) return "High Pollution - Action Recommended";
- return "Very High Pollution - Take Action Immediately";
-}
-
-int main ()
-{
- upm::TP401* airSensor = new upm::TP401(0); // Instantiate new grove air quality sensor on analog pin A0
-
- cout << airSensor->name() << endl;
-
- fprintf(stdout, "Heating sensor for 3 minutes...\n");
- // wait 3 minutes for sensor to warm up
- for(int i = 0; i < 3; i++) {
- if(i) {
- fprintf(stdout, "Please wait, %d minute(s) passed..\n", i);
- }
- sleep(60);
- }
- fprintf(stdout, "Sensor ready!\n");
-
- while(true) {
- uint16_t value = airSensor->getSample(); // Read raw value
- float ppm = airSensor->getPPM(); // Read CO ppm (can vary slightly from previous read)
- fprintf(stdout, "raw: %4d ppm: %5.2f %s\n", value, ppm, airQuality(value).c_str());
- usleep(2500000); // Sleep for 2.5s
- }
-
- delete airSensor;
- return 0;
-}
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/tsl2561.cxx b/peripheral/libupm/examples/c++/tsl2561.cxx
deleted file mode 100644
index 14ddb8a..0000000
--- a/peripheral/libupm/examples/c++/tsl2561.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Nandkishor Sonar <Nandkishor.Sonar@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * LIGHT-TO-DIGITAL CONVERTER [TAOS-TSL2561]
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include <unistd.h>
-#include "tsl2561.h"
-
-int main (int argc, char **argv)
-{
- mraa_result_t error = MRAA_SUCCESS;
- upm::TSL2561 *sensor = NULL;
- int loopCount = 100;
-
-//! [Interesting]
- if (argc < 2) {
- printf("Provide loop count \n");
- } else {
- loopCount = atoi(argv[1]);
- }
- sensor = new upm::TSL2561();
-
- for(int i=0; i< loopCount; i++){
- fprintf(stdout, "Lux = %d\n", sensor->getLux());
- }
-
-//! [Interesting]
-
- delete(sensor);
-
- return (0);
-}
diff --git a/peripheral/libupm/examples/c++/ttp223.cxx b/peripheral/libupm/examples/c++/ttp223.cxx
deleted file mode 100644
index 1d15585..0000000
--- a/peripheral/libupm/examples/c++/ttp223.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "ttp223.h"
-
-int
-main(int argc, char **argv)
-{
- // This example uses GPIO 0
-//! [Interesting]
-
- // Create the TTP223 touch sensor object using GPIO pin 0
- upm::TTP223* touch = new upm::TTP223(0);
-
- // Check whether or not a finger is near the touch sensor and
- // print accordingly, waiting one second between readings
- while( 1 ) {
- if ( touch->isPressed() ) {
- std::cout << touch->name() << " is pressed" << std::endl;
- } else {
- std::cout << touch->name() << " is not pressed" << std::endl;
- }
- sleep(1);
- }
-
- // Delete the touch sensor object
- delete touch;
-//! [Interesting]
-
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/ublox6.cxx b/peripheral/libupm/examples/c++/ublox6.cxx
deleted file mode 100644
index a0cd5f2..0000000
--- a/peripheral/libupm/examples/c++/ublox6.cxx
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "ublox6.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-const size_t bufferLength = 256;
-
-int main (int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a Ublox6 GPS device on uart 0.
- upm::Ublox6* nmea = new upm::Ublox6(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!nmea->setupTty(B9600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- // Collect and output NMEA data. There are various libraries out on
- // the Internet, such as tinyGPS or tinyGPS++ that can handle
- // decoding NMEA data and presenting it in a more easily accessible
- // format. This example will just check for, and read raw NMEA data
- // from the device and output it on stdout.
-
- // This device also supports numerous configuration options, which
- // you can set with writeData(). Please refer to the Ublox-6 data
- // sheet for further information on the formats of the data sent and
- // received, and the various operating modes available.
-
- char nmeaBuffer[bufferLength];
- while (shouldRun)
- {
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (nmea->dataAvailable())
- {
- int rv = nmea->readData(nmeaBuffer, bufferLength);
-
- if (rv > 0)
- write(1, nmeaBuffer, rv);
-
- if (rv < 0) // some sort of read error occured
- {
- cerr << "Port read error." << endl;
- break;
- }
-
- continue;
- }
-
- usleep(100000); // 100ms
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete nmea;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/uln200xa.cxx b/peripheral/libupm/examples/c++/uln200xa.cxx
deleted file mode 100644
index 53a6958..0000000
--- a/peripheral/libupm/examples/c++/uln200xa.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include "uln200xa.h"
-
-using namespace std;
-
-int main ()
-{
- //! [Interesting]
-
- // Instantiate a Stepper motor on a ULN200XA Dual H-Bridge.
-
- // This was tested with the Grove Gear Stepper Motor with Driver
-
- // Wire the pins so that I1 is pin D8, I2 is pin D9, I3 is pin D10 and
- // I4 is pin D11
- upm::ULN200XA* uln200xa = new upm::ULN200XA(4096, 8, 9, 10, 11);
-
- uln200xa->setSpeed(5);
- uln200xa->setDirection(upm::ULN200XA::DIR_CW);
- cout << "Rotating 1 revolution clockwise." << endl;
- uln200xa->stepperSteps(4096);
- cout << "Sleeping for 2 seconds..." << endl;
- sleep(2);
- cout << "Rotating 1/2 revolution counter clockwise." << endl;
- uln200xa->setDirection(upm::ULN200XA::DIR_CCW);
- uln200xa->stepperSteps(2048);
-
- // turn off the power
- uln200xa->release();
-
- //! [Interesting]
- cout << "Exiting..." << endl;
-
- delete uln200xa;
- return 0;
-}
-
diff --git a/peripheral/libupm/examples/c++/urm37-uart.cxx b/peripheral/libupm/examples/c++/urm37-uart.cxx
deleted file mode 100644
index 7a94a1f..0000000
--- a/peripheral/libupm/examples/c++/urm37-uart.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "urm37.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a URM37 sensor on UART 0, with the reset pin on D2
- upm::URM37 *sensor = new upm::URM37(0, 2);
-
- // Every half a second, sample the URM37 and output the measured
- // distance in cm, and temperature in degrees C
-
- while (shouldRun)
- {
- cout << "Detected distance (cm): " << sensor->getDistance() << endl;
- cout << "Temperature (C): " << sensor->getTemperature() << endl;
-
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/urm37.cxx b/peripheral/libupm/examples/c++/urm37.cxx
deleted file mode 100644
index 820b2a1..0000000
--- a/peripheral/libupm/examples/c++/urm37.cxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "urm37.h"
-
-using namespace std;
-
-bool shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
-
- // Instantiate a URM37 sensor on analog pin A0, reset pin on D2,
- // trigger pin on D3 with an analog reference voltage of 5.0
- upm::URM37 *sensor = new upm::URM37(0, 2, 3, 5.0);
-
- // Every half a second, sample the URM37 and output the measured
- // distance in cm.
-
- while (shouldRun)
- {
- cout << "Detected distance (cm): " << sensor->getDistance() << endl;
- usleep(500000);
- }
-
-//! [Interesting]
-
- cout << "Exiting" << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/waterlevel.cxx b/peripheral/libupm/examples/c++/waterlevel.cxx
deleted file mode 100644
index d3a069f..0000000
--- a/peripheral/libupm/examples/c++/waterlevel.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-#include <iostream>
-#include <unistd.h>
-#include <signal.h>
-#include "waterlevel.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-int main(int argc, char **argv)
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // The was tested with the Water Level Sensor
- // Instantiate a Water Level Sensor on digital pin D2
- upm::WaterLevel* waterlevel = new upm::WaterLevel(2);
-
- while (shouldRun)
- {
- if (waterlevel->isSubmerged())
- cout << "Sensor is submerged in liquid" << endl;
- else
- cout << "Liquid is below water level sensor" << endl;
- sleep(1);
- }
-
-//! [Interesting]
- cout << "Exiting" << endl;
-
- delete waterlevel;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/wheelencoder.cxx b/peripheral/libupm/examples/c++/wheelencoder.cxx
deleted file mode 100644
index 08a7825..0000000
--- a/peripheral/libupm/examples/c++/wheelencoder.cxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "wheelencoder.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a DFRobot Wheel Encoder on digital pin D2
- upm::WheelEncoder* sensor = new upm::WheelEncoder(2);
-
- // set the counter to 0 and start counting
- sensor->clearCounter();
- sensor->startCounter();
-
- while (shouldRun)
- {
- // output milliseconds passed and current sensor count
- cout << "Millis: " << sensor->getMillis() << " Count: "
- << sensor->counter() << endl;
-
- sleep(1);
- }
-
- sensor->stopCounter();
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete sensor;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/wt5001.cxx b/peripheral/libupm/examples/c++/wt5001.cxx
deleted file mode 100644
index 317e877..0000000
--- a/peripheral/libupm/examples/c++/wt5001.cxx
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "wt5001.h"
-
-using namespace std;
-
-void printUsage(char *progname)
-{
- cout << "Usage:" << progname << " <command>" << endl;
- cout << "Commands:" << endl;
- cout << "0 - stop playing" << endl;
- cout << "1 - start playing track 1" << endl;
- cout << "2 - pause/un-pause playback" << endl;
- cout << "3 - next track" << endl;
- cout << "4 - previous track" << endl;
-}
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a WT5001 serial MP3 player on uart 0.
- // This example was tested on the Grove Serial MP3 module.
-
- upm::WT5001* mp3 = new upm::WT5001(0);
-
- int cmd = -1;
- if (argc > 1)
- cmd = atoi(argv[1]);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!mp3->setupTty(B9600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- switch (cmd)
- {
- case 0:
- mp3->stop();
- break;
-
- case 1:
- mp3->play(upm::WT5001::SD, 1);
- break;
-
- case 2:
- mp3->pause();
- break;
-
- case 3:
- mp3->next();
- break;
-
- case 4:
- mp3->previous();
- break;
-
- default:
- // nothing, just output usage, and info below
- printUsage(argv[0]);
- break;
- }
-
- // Example: set the date
- // mp3->setDate(2015, 1, 1);
-
- // Example: set the time
- // mp3->setTime(12, 30, 30);
-
- // print out some information
- uint8_t vol = 0;
- if (mp3->getVolume(&vol))
- cout << "The current volume is: " << int(vol) << endl;
-
- uint8_t ps = 0;
- if (mp3->getPlayState(&ps))
- cout << "The current play state is: " << int(ps) << endl;
-
- uint16_t numf = 0;
- if (mp3->getNumFiles(upm::WT5001::SD, &numf))
- cout << "The number of files on the SD card is: " << int(numf) << endl;
-
- uint16_t curf = 0;
- if (mp3->getCurrentFile(&curf))
- cout << "The current file is: " << int(curf) << endl;
-
- uint16_t year = 0;
- uint8_t month = 0, day = 0;
- if (mp3->getDate(&year, &month, &day))
- cout << "The device date is: " << int(month) << "/" << int(day)
- << "/" << int(year) << endl;
-
- uint8_t hour = 0, minute = 0, second = 0;
- if (mp3->getTime(&hour, &minute, &second))
- cout << "The device time is: " << int(hour) << ":" << int(minute)
- << ":" << int(second) << endl;
-
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete mp3;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/xbee.cxx b/peripheral/libupm/examples/c++/xbee.cxx
deleted file mode 100644
index 834d8bc..0000000
--- a/peripheral/libupm/examples/c++/xbee.cxx
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include <stdio.h>
-#include "xbee.h"
-
-using namespace std;
-using namespace upm;
-
-void printUsage(char *progname)
-{
- cout << "Usage: " << progname << " [AT command]" << endl;
- cout << endl;
-
- cout << "If an argument is supplied on the command line, that argument is"
- << endl;
- cout << "sent to the module and the response is printed out." << endl;
- cout << endl;
- cout << "If no argument is used, then the firmware revision, serial number"
- << endl;
- cout << "and the current IP address (if set) are queried." << endl;
- cout << endl;
- cout << endl;
-}
-
-//! [Interesting]
-
-// simple helper function to send a command and wait for a response
-void sendCommand(upm::XBee* sensor, string cmd)
-{
- // commands need to be terminated with a carriage return
- cmd += "\r";
-
- sensor->writeDataStr(cmd);
-
- string resp;
- while (sensor->dataAvailable(2000))
- {
- resp += sensor->readDataStr(1024);
- }
-
- if (resp.empty())
- {
- cerr << "Timed out waiting for response" << endl;
- return;
- }
-
- resp = sensor->stringCR2LF(resp);
- cout << "Returned (" << resp.size() << " bytes): " << endl;
- cout << resp << endl;
-}
-
-int main(int argc, char **argv)
-{
-
- // Instantiate a XBee Module on UART 0
- upm::XBee* sensor = new upm::XBee(0);
-
- // Set the baud rate, 9600 baud is the default.
- if (sensor->setBaudRate(9600))
- {
- cerr << "Failed to set tty baud rate" << endl;
- return 1;
- }
-
- printUsage(argv[0]);
-
- if (argc > 1)
- {
- // enable command mode
- sensor->commandMode();
- cout << "Sending command line argument (" << argv[1] << ")..." << endl;
- sendCommand(sensor, argv[1]);
- }
- else
- {
- // enable command mode
- sensor->commandMode();
- // query the verbose firmware revision
- cout << "Querying verbose firmware revision (ATVL)..." << endl;
- sendCommand(sensor, "ATVL");
- // query the number
- cout << "Querying Serial Number High (ATSH)..." << endl;
- sendCommand(sensor, "ATSH");
- cout << "Querying Serial Number Low (ATSL)..." << endl;
- sendCommand(sensor, "ATSL");
-
- cout << "Querying address, if set (ATMY)..." << endl;
- sendCommand(sensor, "ATMY");
-
- // For the XBee WiFi S6B
- // A comprehensive list of commands and command modes is
- // available from the datasheet at:
- // ftp1.digi.com/support/documentation/90002180_L.pdf
-
- // For the XBee S1
- // A comprehensive list of commands and command modes is
- // available from the datasheet at:
- // http://www.sparkfun.com/datasheets/Wireless/Zigbee/XBee-Datasheet.pdf
-
- // For the XBee WiFi module:
- // An example using AT commands to connect to an AP, with a
- // private Key using WPA2:
-
- // Connect to AP with SSID 'mySSID':
- // ATIDmySSID
-
- // Provide the private key 'secret':
- // ATPKsecret
-
- // Use WPA2 encryption
- // ATEE2
-
- }
-
-
- delete sensor;
- return 0;
-}
-
-//! [Interesting]
diff --git a/peripheral/libupm/examples/c++/yg1006.cxx b/peripheral/libupm/examples/c++/yg1006.cxx
deleted file mode 100644
index 07dbfb5..0000000
--- a/peripheral/libupm/examples/c++/yg1006.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "yg1006.h"
-
-using namespace std;
-
-int shouldRun = true;
-
-void sig_handler(int signo)
-{
- if (signo == SIGINT)
- shouldRun = false;
-}
-
-
-int main ()
-{
- signal(SIGINT, sig_handler);
-
-//! [Interesting]
- // Instantiate a yg1006 flame sensor on digital pin D2
- upm::YG1006* flame = new upm::YG1006(2);
-
- // check every second for the presence of a flame
- while (shouldRun)
- {
- bool val = flame->flameDetected();
- if (val)
- cout << "Flame detected." << endl;
- else
- cout << "No flame detected." << endl;
-
- sleep(1);
- }
-//! [Interesting]
-
- cout << "Exiting..." << endl;
-
- delete flame;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/zfm20-register.cxx b/peripheral/libupm/examples/c++/zfm20-register.cxx
deleted file mode 100644
index fb1292c..0000000
--- a/peripheral/libupm/examples/c++/zfm20-register.cxx
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "zfm20.h"
-
-using namespace std;
-using namespace upm;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a ZFM20 Fingerprint reader on UART 0
-
- upm::ZFM20* fp = new upm::ZFM20(0);
-
- // make sure port is initialized properly. 57600 baud is the default.
- if (!fp->setupTty(B57600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- // This example demonstrates registering a fingerprint on the zfm20
- // module. The procedure is as follows:
- //
- // 1. get an image, store it in characteristics buffer 1
- // 2. get another image, store it in characteristics buffer 2
- // 3. store the image, assuming the two fingerprints match
-
- // first, we need to register our address and password
-
- fp->setPassword(ZFM20_DEFAULT_PASSWORD);
- fp->setAddress(ZFM20_DEFAULT_ADDRESS);
-
- // now verify the password. If this fails, any other commands
- // will be ignored, so we just bail.
- if (fp->verifyPassword())
- {
- cout << "Password verified." << endl;
- }
- else
- {
- cerr << "Password verification failed." << endl;
- return 1;
- }
-
- cout << endl;
-
- uint8_t rv;
- // get the first image
-
- cout << "Place a finger on the sensor." << endl;
- while (fp->generateImage() != ZFM20::ERR_OK)
- ;
-
- // in theory, we have an image
- cout << "Image captured, converting..." << endl;
-
- if ((rv = fp->image2Tz(1)) != ZFM20::ERR_OK)
- {
- cerr << "Image conversion failed with error code " << int(rv) <<endl;
- return 1;
- }
-
- cout << "Image conversion succeeded, remove finger." << endl;
- sleep(1);
-
- while (fp->generateImage() != ZFM20::ERR_NO_FINGER)
- ;
-
- cout << endl;
- cout << "Now place the same finger on the sensor." << endl;
-
- while (fp->generateImage() != ZFM20::ERR_OK)
- ;
-
- cout << "Image captured, converting..." << endl;
-
- // save this one in slot 2
- if ((rv = fp->image2Tz(2)) != ZFM20::ERR_OK)
- {
- cerr << "Image conversion failed with error code " << int(rv) <<endl;
- return 1;
- }
-
- cout << "Image conversion succeeded, remove finger." << endl;
- cout << endl;
-
- cout << "Storing fingerprint at id 1" << endl;
-
- // create the model
- if ((rv = fp->createModel()) != ZFM20::ERR_OK)
- {
- if (rv == ZFM20::ERR_FP_ENROLLMISMATCH)
- cerr << "Fingerprints did not match." << endl;
- else
- cerr << "createModel failed with error code " << int(rv) <<endl;
-
- return 1;
- }
-
- // now store it, we hard code the id (second arg) to 1 here
- if ((rv = fp->storeModel(1, 1)) != ZFM20::ERR_OK)
- {
- cerr << "storeModel failed with error code " << int(rv) <<endl;
- return 1;
- }
-
- cout << endl;
- cout << "Fingerprint stored at id 1." << endl;
-
-//! [Interesting]
-
- delete fp;
- return 0;
-}
diff --git a/peripheral/libupm/examples/c++/zfm20.cxx b/peripheral/libupm/examples/c++/zfm20.cxx
deleted file mode 100644
index a7323b0..0000000
--- a/peripheral/libupm/examples/c++/zfm20.cxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <unistd.h>
-#include <iostream>
-#include <signal.h>
-#include "zfm20.h"
-
-using namespace std;
-using namespace upm;
-
-int main (int argc, char **argv)
-{
-//! [Interesting]
- // Instantiate a ZFM20 Fingerprint reader on UART 0
-
- upm::ZFM20* fp = new upm::ZFM20(0);
-
- // make sure port is initialized properly. 57600 baud is the default.
- if (!fp->setupTty(B57600))
- {
- cerr << "Failed to setup tty port parameters" << endl;
- return 1;
- }
-
- // first, set the default password and address
- fp->setPassword(ZFM20_DEFAULT_PASSWORD);
- fp->setAddress(ZFM20_DEFAULT_ADDRESS);
-
- // now verify the password. If this fails, any other commands
- // will be ignored, so we just bail.
- if (fp->verifyPassword())
- {
- cout << "Password verified." << endl;
- }
- else
- {
- cerr << "Password verification failed." << endl;
- return 1;
- }
-
- // how many valid stored templates (fingerprints) do we have?
- cout << "Total stored templates: " << fp->getNumTemplates() << endl;
- cout << endl;
-
- // now spin waiting for a fingerprint to successfully image
- cout << "Waiting for finger print..." << endl;
-
- while (fp->generateImage() == ZFM20::ERR_NO_FINGER)
- ;
-
- // in theory, we have an image
- cout << "Image captured, converting..." << endl;
-
- uint8_t rv;
- if ((rv = fp->image2Tz(1)) != ZFM20::ERR_OK)
- {
- cerr << "Image conversion failed with error code " << int(rv) <<endl;
- return 1;
- }
-
- cout << "Image conversion succeeded." << endl;
- cout << "Searching database..." << endl;
-
- uint16_t id = 0;
- uint16_t score = 0;
-
- // we search for a print matching slot 1, where we shored our last
- // converted fingerprint
- if ((rv = fp->search(1, &id, &score)) != ZFM20::ERR_OK)
- {
- if (rv == ZFM20::ERR_FP_NOTFOUND)
- {
- cout << "Finger Print not found" << endl;
- return 0;
- }
- else
- {
- cerr << "Search failed with error code " << int(rv) <<endl;
- return 1;
- }
- }
-
- cout << "Fingerprint found!" << endl;
- cout << "ID: " << int(id) << ", Score: " << int(score) << endl;
-
-//! [Interesting]
-
- delete fp;
- return 0;
-}
diff --git a/peripheral/libupm/examples/java/A110XSample.java b/peripheral/libupm/examples/java/A110XSample.java
deleted file mode 100644
index 18d17bc..0000000
--- a/peripheral/libupm/examples/java/A110XSample.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class A110XSample {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- // Instantiate an A110X sensor on digital pin D2
- upm_a110x.A110X hall = new upm_a110x.A110X(2);
-
- // check every second for the presence of a magnetic field (south polarity)
- while(true){
- if(hall.magnetDetected())
- System.out.println("Magnet (south polarity) detected.");
- else
- System.out.println("No magnet detected.");
-
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/A110X_intrSample.java b/peripheral/libupm/examples/java/A110X_intrSample.java
deleted file mode 100644
index 53d23a5..0000000
--- a/peripheral/libupm/examples/java/A110X_intrSample.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class A110X_intrSample {
-
- public static int counter=0;
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- // Instantiate an A110X sensor on digital pin D2
- upm_a110x.A110X hall = new upm_a110x.A110X(2);
-
- // This example uses a user-supplied interrupt handler to count
- // pulses that occur when a magnetic field of the correct polarity
- // is detected. This could be used to measure the rotations per
- // minute (RPM) of a rotor for example.
-
- A110XISR callback = new A110XISR();
- hall.installISR(callback);
-
- while(true){
- System.out.println("Counter: " + counter);
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-}
-
-class A110XISR implements Runnable {
- public A110XISR(){
- super();
- }
- public void run(){
- A110X_intrSample.counter++;
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/ADC121C021Sample.java b/peripheral/libupm/examples/java/ADC121C021Sample.java
deleted file mode 100644
index 5e34cd4..0000000
--- a/peripheral/libupm/examples/java/ADC121C021Sample.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class ADC121C021Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate an ADC121C021 on I2C bus 0
- upm_adc121c021.ADC121C021 adc = new upm_adc121c021.ADC121C021(0);
-
- // An analog sensor, such as a Grove light sensor,
- // must be attached to the adc·
- // Prints the value and corresponding voltage every 50 milliseconds
- while (true) {
- int val = adc.value();
-
- System.out.println("ADC value: " + val + "Volts = " + adc.valueToVolts(val));
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Ad8232Example.java b/peripheral/libupm/examples/java/Ad8232Example.java
deleted file mode 100644
index 3b6102b..0000000
--- a/peripheral/libupm/examples/java/Ad8232Example.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* Author: Abhishek Malik <abhishek.malik@intel.com>
-* Copyright (c) 2016 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-import upm_ad8232.AD8232;
-
-public class Ad8232Example {
-
- static {
- try {
- System.loadLibrary("javaupm_ad8232");
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Instantiate a Ad8232 sensor on digital pins 10 (LO+), 11 (LO-)
- // and an analog pin, 0 (OUTPUT)
- AD8232 ad8232 = new AD8232(10, 11, 0);
- while(true){
- // Output the raw numbers from the ADC, for plotting elsewhere.
- // A return of 0 indicates a Lead Off (LO) condition.
- // In theory, this data could be fed to software like Processing
- // (https://www.processing.org/) to plot the data just like an
- // EKG you would see in a hospital.
- System.out.println(ad8232.value());
- try {
- Thread.sleep(1);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following error has occured: "+e.getMessage());
- }
- }
- }
-
-}
diff --git a/peripheral/libupm/examples/java/Adxl345Sample.java b/peripheral/libupm/examples/java/Adxl345Sample.java
deleted file mode 100644
index 028f658..0000000
--- a/peripheral/libupm/examples/java/Adxl345Sample.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class Adxl345Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- short[] val;
- float[] accel;
-
- // Note: Sensor only works at 3.3V on the Intel Edison with Arduino
- // breakout
- upm_adxl345.Adxl345 sensor = new upm_adxl345.Adxl345(0);
-
- while (true) {
- sensor.update();
- val = sensor.getRawValues();
- accel = sensor.getAcceleration();
-
- System.out.println("Current scale: " + sensor.getScale());
- System.out.println("Raw Values: X: " + val[0] + " Y: " + val[1] + " Z: " + val[2]);
- System.out.println("Acceleration: X: " + accel[0] + "g Y: " + accel[1] + "g Z: "
- + accel[2] + "g");
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Apds9002.java b/peripheral/libupm/examples/java/Apds9002.java
deleted file mode 100644
index 4bb5de8..0000000
--- a/peripheral/libupm/examples/java/Apds9002.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_apds9002.APDS9002;
-
-public class Apds9002 {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Instantiate the APDS9002 (Grove luminance sensor) on the Analog pin A0
- APDS9002 lum = new APDS9002(0);
-
- while(true){
- System.out.println("The Luminance value is : "+lum.value());
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/BISS0001Sample.java b/peripheral/libupm/examples/java/BISS0001Sample.java
deleted file mode 100644
index eaacacf..0000000
--- a/peripheral/libupm/examples/java/BISS0001Sample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class BISS0001Sample{
-
- public static void main(String[] args) throws InterruptedException {
-//! [Interesting]
- // Instantiate a Grove Motion sensor on GPIO pin D7
- upm_biss0001.BISS0001 motion = new upm_biss0001.BISS0001(7);
-
- while (true) {
- boolean value = motion.value();
-
- if(value)
- System.out.println("Detecting moving object");
- else
- System.out.println("No moving objects detected");
-
- Thread.sleep(1000);
- }
-//! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/BMPX8XSample.java b/peripheral/libupm/examples/java/BMPX8XSample.java
deleted file mode 100644
index c803121..0000000
--- a/peripheral/libupm/examples/java/BMPX8XSample.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class BMPX8XSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a BMPX8X sensor on I2C
- upm_bmpx8x.BMPX8X sensor = new upm_bmpx8x.BMPX8X(0);
-
- // Print the pressure, altitude, sea level, and
- // temperature values every second
- while (true) {
- System.out.println("Pressure: " + sensor.getPressure());
- System.out.println("Altitude: " + sensor.getAltitude());
- System.out.println("Sealevel pressure: "
- + sensor.getSealevelPressure());
- System.out.println("Temperature: " + sensor.getTemperature());
- System.out.println();
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/BuzzerSample.java b/peripheral/libupm/examples/java/BuzzerSample.java
deleted file mode 100644
index e94be7f..0000000
--- a/peripheral/libupm/examples/java/BuzzerSample.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class BuzzerSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- int chord[] = {
- upm_buzzer.javaupm_buzzer.DO,
- upm_buzzer.javaupm_buzzer.RE,
- upm_buzzer.javaupm_buzzer.MI,
- upm_buzzer.javaupm_buzzer.FA,
- upm_buzzer.javaupm_buzzer.SOL,
- upm_buzzer.javaupm_buzzer.LA,
- upm_buzzer.javaupm_buzzer.SI};
-
- // Instantiate a buzzer on digital pin D5
- upm_buzzer.Buzzer sound = new upm_buzzer.Buzzer(5);
-
- // print sensor name
- System.out.println(sound.name());
-
- for (int i = 0; i < chord.length; i++) {
- // play each note for one second
- int note = sound.playSound(chord[i], 1000000);
- System.out.println(note);
-
- Thread.sleep(100);
- }
- // ! [Interesting]
- sound.stopSound();
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Buzzer_soundSample.java b/peripheral/libupm/examples/java/Buzzer_soundSample.java
deleted file mode 100644
index 576d888..0000000
--- a/peripheral/libupm/examples/java/Buzzer_soundSample.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class Buzzer_soundSample {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- int chord[] = {
- upm_buzzer.javaupm_buzzer.DO,
- upm_buzzer.javaupm_buzzer.RE,
- upm_buzzer.javaupm_buzzer.MI,
- upm_buzzer.javaupm_buzzer.FA,
- upm_buzzer.javaupm_buzzer.SOL,
- upm_buzzer.javaupm_buzzer.LA,
- upm_buzzer.javaupm_buzzer.SI
- };
-
- // Instantiate a buzzer on digital pin D5
- upm_buzzer.Buzzer sound = new upm_buzzer.Buzzer(5);
-
- // print sensor name
- System.out.println(sound.name());
-
- for (int i = 0; i < chord.length; i++) {
- // play each note for one second
- int note = sound.playSound( chord[i], 1000000);
- System.out.println(note);
-
- Thread.sleep(100);
- }
- //! [Interesting]
- sound.stopSound();
- }
-
-
-}
diff --git a/peripheral/libupm/examples/java/CJQ4435Sample.java b/peripheral/libupm/examples/java/CJQ4435Sample.java
deleted file mode 100644
index 333c20e..0000000
--- a/peripheral/libupm/examples/java/CJQ4435Sample.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class CJQ4435Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3
- upm_cjq4435.CJQ4435 mosfet = new upm_cjq4435.CJQ4435(3);
-
- mosfet.setPeriodMS(10);
- mosfet.enable(true);
-
- while (true) {
- // start with a duty cycle of 0.0 (off) and increment to 1.0 (on)
- for (float i = 0; i <= 1; i += 0.1) {
- mosfet.setDutyCycle(i);
- Thread.sleep(100);
- }
- Thread.sleep(1000);
-
- // Now take it back down
- // start with a duty cycle of 1.0 (on) and decrement to 0.0 (off)
- for (float i = 1; i >= 0; i -= 0.1) {
- mosfet.setDutyCycle(i);
- Thread.sleep(100);
- }
- Thread.sleep(1000);
- }
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/CMakeLists.txt b/peripheral/libupm/examples/java/CMakeLists.txt
deleted file mode 100644
index 95d187a..0000000
--- a/peripheral/libupm/examples/java/CMakeLists.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-find_package(Java REQUIRED)
-include(UseJava)
-
-macro(add_example example_name jar_name)
- set(example_src "${example_name}.java")
- set(example_jar "${CMAKE_CURRENT_BINARY_DIR}/../../src/${jar_name}/upm_${jar_name}.jar")
-
- add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${example_jar})
-endmacro()
-
-macro(add_example_with_path example_name jar_path)
- set(example_src "${example_name}.java")
- set(example_jar "${CMAKE_CURRENT_BINARY_DIR}/../../src/${jar_path}")
-
- add_jar(${example_name} SOURCES ${example_src} INCLUDE_JARS ${example_jar})
-endmacro()
-
-add_example(A110X_intrSample a110x)
-add_example(A110XSample a110x)
-add_example(ADC121C021Sample adc121c021)
-add_example(Adxl345Sample adxl345)
-add_example(Apds9002 apds9002)
-add_example(BISS0001Sample biss0001)
-add_example(BMPX8XSample bmpx8x)
-add_example(BuzzerSample buzzer)
-add_example(Buzzer_soundSample buzzer)
-add_example(CJQ4435Sample cjq4435)
-add_example(DS1307Sample ds1307)
-add_example(ENC03RSample enc03r)
-add_example(ES08ASample servo)
-add_example(GroveButtonSample grove)
-add_example(GroveButton_intrSample grove)
-add_example(GroveCollision grovecollision)
-add_example(GroveEHRSample groveehr)
-add_example(GroveEmg groveemg)
-add_example(GroveGsr grovegsr)
-add_example(GroveLed_multiSample grove)
-add_example(GroveLEDSample grove)
-add_example(GroveLightSample grove)
-add_example(GroveLineFinderSample grovelinefinder)
-add_example(GroveMDSample grovemd)
-add_example(GroveMoistureSample grovemoisture)
-add_example(GroveMQ3 gas)
-add_example(GroveMQ9 gas)
-add_example(GroveO2Example groveo2)
-add_example(GroveQTouch at42qt1070)
-add_example(GroveRelaySample grove)
-add_example(GroveRotarySample grove)
-add_example(GROVESCAMSample grovescam)
-add_example(GroveSlideSample grove)
-add_example(GroveSpeakerSample grovespeaker)
-add_example(GroveTempSample grove)
-add_example(GroveVDivSample grovevdiv)
-add_example(GroveWaterSample grovewater)
-add_example(GroveWFSSample grovewfs)
-add_example(GUVAS12DSample guvas12d)
-add_example(H3LIS331DLSample h3lis331dl)
-add_example(HCSR04Sample hcsr04)
-add_example(HM11Sample hm11)
-add_example(Hmc5883lSample hmc5883l)
-add_example(HMTRPSample hmtrp)
-add_example(HP20xExample hp20x)
-add_example(HTU21DSample htu21d)
-add_example(Itg3200Sample itg3200)
-add_example(Joystick12Sample joystick12)
-add_example(LDT0028Sample ldt0028)
-add_example(LoLSample lol)
-add_example(LSM303Sample lsm303)
-add_example(M24LR64ESample m24lr64e)
-add_example(MAX44000Sample max44000)
-add_example(MHZ16Sample mhz16)
-add_example(MicrophoneSample mic)
-add_example(MMA7455Sample mma7455)
-add_example(MMA7660Sample mma7660)
-add_example(MPL3115A2Sample mpl3115a2)
-add_example(MPR121Sample mpr121)
-add_example(MPU9150Sample mpu9150)
-add_example(MQ2Sample gas)
-add_example(MQ303ASample mq303a)
-add_example(MQ5Sample gas)
-add_example(GroveLEDBar my9221)
-add_example(NRF24L01_receiverSample nrf24l01)
-add_example(NRF24L01_transmitterSample nrf24l01)
-add_example(NUNCHUCKSample nunchuck)
-add_example(OTP538USample otp538u)
-add_example(PPD42NSSample ppd42ns)
-add_example(PulsensorSample pulsensor)
-add_example(RFR359FSample rfr359f)
-add_example(RotaryEncoderSample rotaryencoder)
-add_example(RPR220_intrSample rpr220)
-add_example(RPR220Sample rpr220)
-add_example(ST7735Sample st7735)
-add_example(StepMotorSample stepmotor)
-add_example(TM1637Sample tm1637)
-add_example(TP401Sample gas)
-add_example(TSL2561Sample tsl2561)
-add_example(TTP223Sample ttp223)
-add_example(Ublox6Sample ublox6)
-add_example(ULN200XASample uln200xa)
-add_example(WaterLevelSensor waterlevel)
-add_example(WT5001Sample wt5001)
-add_example(YG1006Sample yg1006)
-add_example(ZFM20Sample zfm20)
-add_example(Ad8232Example ad8232)
-add_example(Gp2y0aExample gp2y0a)
-add_example(Th02Example th02)
-add_example(FlexSensorExample flex)
-
-
-add_example_with_path(Jhd1313m1_lcdSample lcd/upm_i2clcd.jar)
-add_example_with_path(Jhd1313m1Sample lcd/upm_i2clcd.jar)
-add_example_with_path(Lcm1602_i2cSample lcd/upm_i2clcd.jar)
-add_example_with_path(Lcm1602_parallelSample lcd/upm_i2clcd.jar)
-add_example_with_path(SSD1308_oledSample lcd/upm_i2clcd.jar)
-add_example_with_path(SSD1327_oledSample lcd/upm_i2clcd.jar)
-
diff --git a/peripheral/libupm/examples/java/DS1307Sample.java b/peripheral/libupm/examples/java/DS1307Sample.java
deleted file mode 100644
index 89ae5dc..0000000
--- a/peripheral/libupm/examples/java/DS1307Sample.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class DS1307Sample {
-
- static private void printTime(upm_ds1307.DS1307 rtc) {
- System.out.print("The time is: " + rtc.getMonth() + "/" + rtc.getDayOfMonth() + "/"
- + rtc.getYear() + " " + rtc.getHours() + ":" + rtc.getMinutes() + ":"
- + rtc.getSeconds());
-
- if (rtc.getAmPmMode()) {
- if (rtc.getAmPmMode())
- System.out.print(" PM");
- else
- System.out.print(" AM");
- }
-
- System.out.println();
-
- if (rtc.getAmPmMode())
- System.out.println("Clock is in AM/PM mode");
- else
- System.out.println("Clock is in 24h mode");
-
- }
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a DS1037 on I2C bus 0
- upm_ds1307.DS1307 rtc = new upm_ds1307.DS1307(0);
-
- // always do this first
- System.out.println("Loading the current time...");
- if (!rtc.loadTime()) {
- System.err.println("rtc->loadTime() failed.");
- System.exit(-1);
- }
-
- printTime(rtc);
-
- // set the year as an example
- System.out.println("setting the year to 50");
- rtc.setYear(50);
- rtc.setTime();
-
- // reload the time and print it
- rtc.loadTime();
- printTime(rtc);
-
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/ENC03RSample.java b/peripheral/libupm/examples/java/ENC03RSample.java
deleted file mode 100644
index c2aa0bd..0000000
--- a/peripheral/libupm/examples/java/ENC03RSample.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class ENC03RSample {
- private static final long CALIBRATION_SAMPLES = 1000;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
-
- // Instantiate a ENC03R on analog pin A0
- upm_enc03r.ENC03R gyro = new upm_enc03r.ENC03R(0);
-
- System.out.println("Please place the sensor in a stable location, and do not");
- System.out.println("move it while calibration takes place");
- System.out.println("This may take a couple of minutes.");
-
- gyro.calibrate(CALIBRATION_SAMPLES);
- System.out.println("Calibration complete. Reference value: " + gyro.calibrationValue());
-
- // Read the input and print both the raw value and the angular velocity,
- // waiting 1 second between readings
- while (true) {
- long val = gyro.value();
- double av = gyro.angularVelocity(val);
-
- System.out.println("Raw value: " + val + ", angular velocity: " + av + " deg/s");
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/ES08ASample.java b/peripheral/libupm/examples/java/ES08ASample.java
deleted file mode 100644
index 0285204..0000000
--- a/peripheral/libupm/examples/java/ES08ASample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class ES08ASample {
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_servo.ES08A servo = new upm_servo.ES08A(6);
-
- // Sets the shaft to 180, then to 90, then to 0,
- // then back to 90, and finally back to 180,
- // pausing for a second in between each angle
- servo.setAngle(180);
- System.out.println("Set angle to 180");
- Thread.sleep(1000);
-
- servo.setAngle(90);
- System.out.println("Set angle to 90");
- Thread.sleep(1000);
-
- servo.setAngle(0);
- System.out.println("Set angle to 0");
- Thread.sleep(1000);
-
- servo.setAngle(90);
- System.out.println("Set angle to 90");
- Thread.sleep(1000);
-
- servo.setAngle(180);
- System.out.println("Set angle to 180");
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/FlexSensorExample.java b/peripheral/libupm/examples/java/FlexSensorExample.java
deleted file mode 100644
index ce4e697..0000000
--- a/peripheral/libupm/examples/java/FlexSensorExample.java
+++ /dev/null
@@ -1,41 +0,0 @@
-import upm_flex.Flex;
-
-public class FlexSensorExample {
-
- static {
- try {
- System.loadLibrary("javaupm_flex");
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // The was tested with a Spectra Symbol flex sensor.
- // We attached a 22K resistor to a breadboard,
- // with 1 end attached to GND and the other connected to
- // both the flex sensor and A0.
- // The flex sensor was connected on 1 pin to the 22K resistor and A0
- // and on the other pin to 5V.
-
- // Instantiate a Flex sensor on analog pin A0
- Flex flex = new Flex(0);
- while(true){
- System.out.println("Flex Sensor value is: "+flex.value());
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- //! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GROVESCAMSample.java b/peripheral/libupm/examples/java/GROVESCAMSample.java
deleted file mode 100644
index 1e4a374..0000000
--- a/peripheral/libupm/examples/java/GROVESCAMSample.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class GROVESCAMSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Serial Camera on UART 0
- upm_grovescam.GROVESCAM camera = new upm_grovescam.GROVESCAM(0);
-
- // make sure port is initialized properly. 115200 baud is the default.
- if (!camera.setupTty()) {
- System.err.println("Failed to setup tty port parameters");
- System.exit(-1);
- }
-
- if (camera.init())
- System.out.println("Initialized...");
- else
- System.out.println("Initialization failed");
-
- if (camera.preCapture())
- System.out.println("preCapture succeeded...");
- else
- System.out.println("preCapture failed.");
-
- if (camera.doCapture())
- System.out.println("doCapture succeeded...");
- else
- System.out.println("doCapture failed.");
-
- if (camera.getImageSize() > 0) {
- System.out.println("Storing image.jpg...");
-
- if (camera.storeImage("image.jpg"))
- System.out.println("storeImage succeeded...");
- else
- System.out.println("storeImage failed.");
-
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GUVAS12DSample.java b/peripheral/libupm/examples/java/GUVAS12DSample.java
deleted file mode 100644
index 0cd4115..0000000
--- a/peripheral/libupm/examples/java/GUVAS12DSample.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GUVAS12DSample {
- // analog voltage, usually 3.3 or 5.0
- private static final float GUVAS12D_AREF = 5;
- private static final int SAMPLES_PER_QUERY = 1024;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a GUVAS12D on analog pin A3
- upm_guvas12d.GUVAS12D volts = new upm_guvas12d.GUVAS12D(3);
-
- while (true) {
- float value = volts.value(GUVAS12D_AREF, SAMPLES_PER_QUERY);
-
- System.out.println("AREF: " + GUVAS12D_AREF
- + ", Voltage value (higher means more UV): " + value);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Gp2y0aExample.java b/peripheral/libupm/examples/java/Gp2y0aExample.java
deleted file mode 100644
index 0837f55..0000000
--- a/peripheral/libupm/examples/java/Gp2y0aExample.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-import upm_gp2y0a.GP2Y0A;
-
-public class Gp2y0aExample {
-
- public static final float GP2Y0A_AREF = 5;
- public static final short SAMPLES_PER_QUERY = 20;
-
- static {
- try {
- System.loadLibrary("javaupm_gp2y0a");
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Note, for the Grove 80cm version of this sensor, due to the way
- // it is wired, you need to plug this into the A0 port, where it
- // will use the available A1 pin for data.
-
- // Instantiate a GP2Y0A on analog pin A1
- GP2Y0A gp2y0a = new GP2Y0A(1);
-
- // The higher the voltage (closer to AREF) the closer the object is. NOTE:
- // the measured voltage will probably not exceed 3.3 volts.
- // Every second, print the averaged voltage value (averaged over 20 samples).
- while(true){
- System.out.println("AREF: " + GP2Y0A_AREF + "\t, Voltage Value (Higher means Closer): "+ gp2y0a.value(GP2Y0A_AREF, SAMPLES_PER_QUERY));
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveButtonSample.java b/peripheral/libupm/examples/java/GroveButtonSample.java
deleted file mode 100644
index 9be6e2f..0000000
--- a/peripheral/libupm/examples/java/GroveButtonSample.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveButtonSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Create the button object using GPIO pin 2
- upm_grove.GroveButton button = new upm_grove.GroveButton(2);
-
- while (true) {
- System.out.println(button.name() + " value is " + button.value());
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveButton_intrSample.java b/peripheral/libupm/examples/java/GroveButton_intrSample.java
deleted file mode 100644
index ad0d72e..0000000
--- a/peripheral/libupm/examples/java/GroveButton_intrSample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveButton_intrSample {
-
- public static int counter = 0;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_grove.GroveButton b = new upm_grove.GroveButton(2);
-
- ButtonISR callback = new ButtonISR();
- b.installISR(2, callback);
-
- while (true) {
- System.out.println("Counter: " + counter);
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-}
-
-class ButtonISR implements Runnable {
- public ButtonISR() {
- super();
- }
-
- public void run() {
- GroveButton_intrSample.counter++;
- System.out.println("Button pressed!");
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveCollision.java b/peripheral/libupm/examples/java/GroveCollision.java
deleted file mode 100644
index e1ace72..0000000
--- a/peripheral/libupm/examples/java/GroveCollision.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_grovecollision.*;
-
-public class GroveCollision {
-
- public static void main(String[] args) {
- // Initializing the sensor on D2 on the Base Shield
- upm_grovecollision.GroveCollision collision = new upm_grovecollision.GroveCollision(2);
- boolean collisionState = false;
-
- // ! [Interesting]
- while(true){
- if(collision.isColliding() && !collisionState){
- System.out.println("Collision!!");
- collisionState = true;
- }
- else if (collisionState){
- System.out.println("No Collision!");
- collisionState = false;
- }
- }
- // ! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/GroveEHRSample.java b/peripheral/libupm/examples/java/GroveEHRSample.java
deleted file mode 100644
index ddec36a..0000000
--- a/peripheral/libupm/examples/java/GroveEHRSample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class GroveEHRSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2
- upm_groveehr.GroveEHR heart = new upm_groveehr.GroveEHR(2);
-
- // set the beat counter to 0, init the clock and start counting beats
- heart.clearBeatCounter();
- heart.initClock();
- heart.startBeatCounter();
-
- while (true) {
- long millis = heart.getMillis();
- long beats = heart.beatCounter();
-
- // heartRate() requires that at least 5 seconds pass before
- // returning anything other than 0
- int hr = heart.heartRate();
-
- // output milliseconds passed, beat count, and computed heart rate
- System.out.println("Millis: " + millis + ", Beats: " + beats + ", Heart rate: " + hr);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveEmg.java b/peripheral/libupm/examples/java/GroveEmg.java
deleted file mode 100644
index eaa8ba0..0000000
--- a/peripheral/libupm/examples/java/GroveEmg.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-import upm_groveemg.GroveEMG;
-
-public class GroveEmg {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Instantiating the Grove EMG sensor on Analog pin 0
- GroveEMG emg = new GroveEMG(0);
- System.out.println("Calibrating ... ");
- emg.calibrate();
-
- while(true){
- System.out.println("EMG Val: "+emg.value());
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- }
- //! [Interesting]
-}
diff --git a/peripheral/libupm/examples/java/GroveGsr.java b/peripheral/libupm/examples/java/GroveGsr.java
deleted file mode 100644
index 08a04b9..0000000
--- a/peripheral/libupm/examples/java/GroveGsr.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_grovegsr.GroveGSR;
-
-public class GroveGsr {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- //! [Interesting]
- // Instantiate a Grove GSR sensor on analog pin A0
- GroveGSR gsr = new GroveGSR(0);
- System.out.println("Calibrating...");
- gsr.calibrate();
-
- while(true){
- System.out.println("Value: "+gsr.value());
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/GroveLEDBar.java b/peripheral/libupm/examples/java/GroveLEDBar.java
deleted file mode 100644
index 51d2f71..0000000
--- a/peripheral/libupm/examples/java/GroveLEDBar.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveLEDBar {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- // Instantiate a Grove LED Bar, with Data pin D8 and Clock pin D9
- upm_my9221.GroveLEDBar bar = new upm_my9221.GroveLEDBar((short) 8, (short) 9);
-
- while (true) {
- for (short idx = 1; idx < 11; idx++) {
- bar.setBarLevel(idx);
- Thread.sleep(100);
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/GroveLEDSample.java b/peripheral/libupm/examples/java/GroveLEDSample.java
deleted file mode 100644
index b996449..0000000
--- a/peripheral/libupm/examples/java/GroveLEDSample.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveLEDSample {
- public static void main (String args[]) throws InterruptedException {
- //! [Interesting]
- upm_grove.GroveLed led = new upm_grove.GroveLed(2);
-
- for (int i = 0; i < 10; ++i) {
- led.on();
- Thread.sleep(1000);
- led.off();
- Thread.sleep(1000);
- }
- led.delete();
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/GroveLed_multiSample.java b/peripheral/libupm/examples/java/GroveLed_multiSample.java
deleted file mode 100644
index 98d792c..0000000
--- a/peripheral/libupm/examples/java/GroveLed_multiSample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class GroveLed_multiSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a grove LED on D2. Here we are controlling a Grove
- // Multi-color flash LED. We just just need to turn it on - it will
- // then cycle through various colors (red, green, blue, purple) on it's
- // own until turned off.
- upm_grove.GroveLed led = new upm_grove.GroveLed(2);
-
- // start the light show
- led.on();
-
- // just sleep until interrupted
- while (true) {
- Thread.sleep(1);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveLightSample.java b/peripheral/libupm/examples/java/GroveLightSample.java
deleted file mode 100644
index 611b744..0000000
--- a/peripheral/libupm/examples/java/GroveLightSample.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveLightSample {
- public static void main(String args[]) throws InterruptedException {
- // ! [Interesting]
- upm_grove.GroveLight gl = new upm_grove.GroveLight(2);
-
- while (true) {
- float raw_value = gl.raw_value();
- float value = gl.value();
-
- System.out.println("raw value: " + raw_value);
- System.out.println("value: " + value);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveLineFinderSample.java b/peripheral/libupm/examples/java/GroveLineFinderSample.java
deleted file mode 100644
index 2baa418..0000000
--- a/peripheral/libupm/examples/java/GroveLineFinderSample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveLineFinderSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Line Finder sensor on digital pin D2
- upm_grovelinefinder.GroveLineFinder finder = new upm_grovelinefinder.GroveLineFinder(2);
- // check every second for the presence of white detection
- while (true) {
- boolean val = finder.whiteDetected();
- if (val) {
- System.out.println("White detected");
- } else {
- System.out.println("Black detected");
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveMDSample.java b/peripheral/libupm/examples/java/GroveMDSample.java
deleted file mode 100644
index 9bb4bb7..0000000
--- a/peripheral/libupm/examples/java/GroveMDSample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveMDSample {
- private static final short speed50 = 127;
- private static final short speed0 = 0;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate an I2C Grove Motor Driver on I2C bus 0
- upm_grovemd.GroveMD motors = new upm_grovemd.GroveMD();
-
- // set direction to clockwise (CW) and set speed to 50%
- System.out.println("Spin M1 and M2 at half speed for 3 seconds");
- motors.setMotorDirections(upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CW,
- upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CW);
- motors.setMotorSpeeds(speed50, speed50);
- Thread.sleep(3000);
-
- // counter clockwise (CCW)
- System.out.println("Reversing M1 and M2 for 3 seconds");
- motors.setMotorDirections(upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CCW,
- upm_grovemd.GroveMD.DC_DIRECTION_T.DIR_CCW);
- Thread.sleep(3000);
-
- // stop motors
- System.out.println("Stopping motors");
- motors.setMotorSpeeds(speed0, speed0);
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveMQ3.java b/peripheral/libupm/examples/java/GroveMQ3.java
deleted file mode 100644
index c101189..0000000
--- a/peripheral/libupm/examples/java/GroveMQ3.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_gas.Gas;
-import upm_gas.MQ2;
-import upm_gas.MQ3;
-import upm_gas.MQ4;
-import upm_gas.MQ5;
-import upm_gas.MQ6;
-import upm_gas.MQ7;
-import upm_gas.MQ8;
-import upm_gas.MQ9;
-import upm_gas.TP401;
-import upm_gas.thresholdContext;
-
-public class GroveMQ3 {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // initialize the sensor on A0
- MQ3 mq3 = new MQ3(0);
-
- short[] buffer = new short[128];
-
- thresholdContext context = new thresholdContext();
-
- context.setAverageReading(0);
- context.setRunningAverage(0);
- context.setAveragedOver(2);
-
- int len;
- int thres;
- while(true){
- len = mq3.getSampledWindow((long)2, buffer);
-
- if(len != 0){
- thres = mq3.findThreshold(context, 30, buffer);
- mq3.printGraph(context, (short)5);
- if(thres != 0){
- // do something
- System.out.println("threshold is crossed");
- }
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/GroveMQ9.java b/peripheral/libupm/examples/java/GroveMQ9.java
deleted file mode 100644
index 24b916d..0000000
--- a/peripheral/libupm/examples/java/GroveMQ9.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_gas.Gas;
-import upm_gas.MQ2;
-import upm_gas.MQ3;
-import upm_gas.MQ4;
-import upm_gas.MQ5;
-import upm_gas.MQ6;
-import upm_gas.MQ7;
-import upm_gas.MQ8;
-import upm_gas.MQ9;
-import upm_gas.TP401;
-import upm_gas.thresholdContext;
-
-public class GroveMQ9 {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // initialize the sensor on A0
- MQ9 mq9 = new MQ9(0);
-
- short[] buffer = new short[128];
-
- thresholdContext context = new thresholdContext();
-
- context.setAverageReading(0);
- context.setRunningAverage(0);
- context.setAveragedOver(2);
-
- int len;
- int thres;
- while(true){
- len = mq9.getSampledWindow((long)2, buffer);
-
- if(len != 0){
- thres = mq9.findThreshold(context, 30, buffer);
- mq9.printGraph(context, (short)5);
- if(thres != 0){
- // do something
- System.out.println("threshold is crossed");
- }
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/GroveMoistureSample.java b/peripheral/libupm/examples/java/GroveMoistureSample.java
deleted file mode 100644
index 8fb32d6..0000000
--- a/peripheral/libupm/examples/java/GroveMoistureSample.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveMoistureSample {
- public static void main(String args[]) throws InterruptedException {
- // ! [Interesting]
- upm_grovemoisture.GroveMoisture gm = new upm_grovemoisture.GroveMoisture(1);
-
- while (true) {
- int moisture_val = gm.value();
- String result;
-
- if (moisture_val >= 0 && moisture_val < 300)
- result = "Dry";
- else if ((moisture_val >= 0 && moisture_val < 300))
- result = "Moist";
- else
- result = "Wet";
-
- System.out.println("Moisture Value: " + moisture_val + ", " + result);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveO2Example.java b/peripheral/libupm/examples/java/GroveO2Example.java
deleted file mode 100644
index fe22b80..0000000
--- a/peripheral/libupm/examples/java/GroveO2Example.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_groveo2.GroveO2;
-
-public class GroveO2Example {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Initializing the Grove O2 sensor on the A) analog pin
- GroveO2 o2 = new GroveO2(0);
-
- while(true){
- System.out.println("The output voltage is: "+o2.voltageValue());
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception has occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/GroveQTouch.java b/peripheral/libupm/examples/java/GroveQTouch.java
deleted file mode 100644
index 795e4ac..0000000
--- a/peripheral/libupm/examples/java/GroveQTouch.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_at42qt1070.AT42QT1070;
-
-public class GroveQTouch {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- // Instantiating the Q Touch sensor on the I2C bus 0
- AT42QT1070 touch = new AT42QT1070(0, (short) 0x1b);
- short pressedButtons;
-
- // ! [Interesting]
- while(true){
- touch.updateState();
- printButtons(touch.getButtons());
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- // ! [Interesting]
- }
-
- /**
- * This function prints out the button numbers from 0 through 6
- * @param buttonNumber
- */
- public static void printButtons(int buttonNumber){
- boolean buttonPressed = false;
- System.out.print("Button Pressed: ");
- for(int i=0;i<7;i++){
- if((buttonNumber & (1<<i)) != 0){
- System.out.println(i+" ");
- buttonPressed = true;
- }
- }
-
-
-
- if(!buttonPressed){
- System.out.println("None ");
- }
- }
-}
diff --git a/peripheral/libupm/examples/java/GroveRelaySample.java b/peripheral/libupm/examples/java/GroveRelaySample.java
deleted file mode 100644
index 56a044b..0000000
--- a/peripheral/libupm/examples/java/GroveRelaySample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveRelaySample {
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Create the button object using UART
- upm_grove.GroveRelay relay = new upm_grove.GroveRelay(5);
-
- for (int i = 0; i < 3; i++) {
- relay.on();
- if (relay.isOn())
- System.out.println("Relay is on");
- Thread.sleep(1000);
-
- relay.off();
- if (relay.isOff())
- System.out.println("Relay is off");
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveRotarySample.java b/peripheral/libupm/examples/java/GroveRotarySample.java
deleted file mode 100644
index f1b98c7..0000000
--- a/peripheral/libupm/examples/java/GroveRotarySample.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveRotarySample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_grove.GroveRotary knob = new upm_grove.GroveRotary(0);
-
- while (true) {
- float abs_value = knob.abs_value(); // Absolute raw value
- float abs_deg = knob.abs_deg(); // Absolute degrees
- float abs_rad = knob.abs_rad(); // Absolute radians
- float rel_value = knob.rel_value(); // Relative raw value
- float rel_deg = knob.rel_deg(); // Relative degrees
- float rel_rad = knob.rel_rad(); // Relative radians
-
- System.out.println("Absolute: " + abs_value + " raw, " + abs_deg + " deg, " + abs_rad
- + " rad");
- System.out.println("Relative: " + rel_value + " raw, " + rel_deg + " deg, " + rel_rad
- + " rad");
-
- Thread.sleep(3000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveSlideSample.java b/peripheral/libupm/examples/java/GroveSlideSample.java
deleted file mode 100644
index b159713..0000000
--- a/peripheral/libupm/examples/java/GroveSlideSample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveSlideSample {
- public static void main (String args[]) throws InterruptedException {
- //! [Interesting]
- // Instantiate new grove slide potentiometer on analog pin A0
- upm_grove.GroveSlide slide = new upm_grove.GroveSlide(0);
-
- while (true) {
- float raw_value = slide.raw_value();
- float value = slide.voltage_value();
-
- System.out.println("raw value: " + raw_value);
- System.out.println("value: " + value);
-
- Thread.sleep(2500);
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/GroveSpeakerSample.java b/peripheral/libupm/examples/java/GroveSpeakerSample.java
deleted file mode 100644
index 2e96c89..0000000
--- a/peripheral/libupm/examples/java/GroveSpeakerSample.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveSpeakerSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Speaker on digital pin D2
- upm_grovespeaker.GroveSpeaker speaker = new upm_grovespeaker.GroveSpeaker(2);
-
- // Play all 7 of the lowest notes
- speaker.playAll();
-
- // Play a medium C-sharp
- speaker.playSound('c', true, "med");
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveTempSample.java b/peripheral/libupm/examples/java/GroveTempSample.java
deleted file mode 100644
index 6878827..0000000
--- a/peripheral/libupm/examples/java/GroveTempSample.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveTempSample {
- public static void main (String args[]) throws InterruptedException {
- //! [Interesting]
- upm_grove.GroveTemp temp = new upm_grove.GroveTemp(3);
-
- for (int i = 0; i < 10; ++i) {
-
- int celsius = temp.value();
- int fahrneheit = celsius * 2 + 32;
-
- System.out.println("Celsius: " + celsius);
- System.out.println("Fahrneheit: " + fahrneheit);
-
- Thread.sleep(1000);
- }
- temp.delete();
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/GroveVDivSample.java b/peripheral/libupm/examples/java/GroveVDivSample.java
deleted file mode 100644
index 579f2c3..0000000
--- a/peripheral/libupm/examples/java/GroveVDivSample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class GroveVDivSample {
- private static final short gain3 = 3;
- private static final short gain10 = 10;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Voltage Divider sensor on analog pin A0
- upm_grovevdiv.GroveVDiv vDiv = new upm_grovevdiv.GroveVDiv(0);
-
- // collect data and output measured voltage according to the setting
- // of the scaling switch (3 or 10)
- while (true) {
- long val = vDiv.value(100);
- float gain3val = vDiv.computedValue(gain3, val);
- float gain10val = vDiv.computedValue(gain10, val);
-
- System.out.println("ADC value: " + val + ", Gain 3: " + gain3val + "v, Gain 10: "
- + gain10val);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveWFSSample.java b/peripheral/libupm/examples/java/GroveWFSSample.java
deleted file mode 100644
index 5ab4997..0000000
--- a/peripheral/libupm/examples/java/GroveWFSSample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class GroveWFSSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Water Flow Sensor on digital pin D2
- upm_grovewfs.GroveWFS flow = new upm_grovewfs.GroveWFS(2);
-
- flow.clearFlowCounter();
- flow.startFlowCounter();
-
- while (true) {
- System.out.print("Millis: " + flow.getMillis() + " FlowCount: " + flow.flowCounter());
- System.out.println(" Flow Rate: " + flow.flowRate() + " LPM");
-
- Thread.sleep(2000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/GroveWaterSample.java b/peripheral/libupm/examples/java/GroveWaterSample.java
deleted file mode 100644
index f275df7..0000000
--- a/peripheral/libupm/examples/java/GroveWaterSample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class GroveWaterSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Water sensor on digital pin D2
- upm_grovewater.GroveWater water = new upm_grovewater.GroveWater(2);
-
- while (true) {
- boolean val = water.isWet();
- if (val) {
- System.out.println("Sensor is wet");
- } else {
- System.out.println("Sensor is dry");
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/H3LIS331DLSample.java b/peripheral/libupm/examples/java/H3LIS331DLSample.java
deleted file mode 100644
index ee1db39..0000000
--- a/peripheral/libupm/examples/java/H3LIS331DLSample.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class H3LIS331DLSample {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- int[] val;
- float[] accel;
-
- // Instantiate an H3LIS331DL on I2C bus 0
- upm_h3lis331dl.H3LIS331DL sensor = new upm_h3lis331dl.H3LIS331DL(0);
-
- // Initialize the device with default values
- sensor.init();
-
- while(true){
- sensor.update();
-
- val = sensor.getRawXYZ();
- System.out.println( "Raw: X: " + val[0] + " Y: " + val[1] + " Z: " + val[2] );
-
- accel = sensor.getAcceleration();
- System.out.println( "Acceleration: X: " + accel[0] + " Y: " + accel[1] + " Z: " + accel[2] );
-
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/HCSR04Sample.java b/peripheral/libupm/examples/java/HCSR04Sample.java
deleted file mode 100644
index ee90773..0000000
--- a/peripheral/libupm/examples/java/HCSR04Sample.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class HCSR04Sample {
-
- // ! [Interesting]
- public static void main(String[] args) throws InterruptedException {
- upm_hcsr04.HCSR04 sonar = new upm_hcsr04.HCSR04((short) 5, (short) 6);
-
- Thread.sleep(1000);
-
- while (true) {
- System.out.println("Get distance");
- double distance = sonar.getDistance(upm_hcsr04.javaupm_hcsr04Constants.CM);
- System.out.println("Distance: " + distance);
-
- Thread.sleep(5000);
- }
- }
-}
-// ! [Interesting] \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/HM11Sample.java b/peripheral/libupm/examples/java/HM11Sample.java
deleted file mode 100644
index b37ae21..0000000
--- a/peripheral/libupm/examples/java/HM11Sample.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class HM11Sample {
-
- private static final int BUFSIZ = 1024;
-
- private static void printUsage() {
- System.out.println("Usage: java HM11Sample [AT command]");
-
- System.out.println("If an argument is supplied on the command line, that argument is");
- System.out.println("sent to the module and the response is printed out.");
- System.out.println("If no argument is used, then the address and PIN of the module");
- System.out.println("are queried and the results printed out.");
-
- }
-
- private static void sendCommand(upm_hm11.HM11 ble, byte[] cmd) {
- byte[] buffer = new byte[BUFSIZ];
- ble.writeData(cmd);
-
- // wait up to 1 second
- if (ble.dataAvailable(1000)) {
- ble.readData(buffer);
- } else {
- System.err.println("Timed out waiting for response");
- }
-
- }
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a HM11 BLE Module on UART 0
- upm_hm11.HM11 ble = new upm_hm11.HM11(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!ble.setupTty()) {
- System.err.println("Failed to setup tty port parameters");
- System.exit(-1);
- }
-
- printUsage();
-
- if (args.length > 0) {
- System.out.println("Sending command line argument (" + args[0] + ")...");
- sendCommand(ble, args[0].getBytes());
- } else {
- // query the module address
- String addr = "AT+ADDR?";
- System.out.println("Querying module address (" + addr + ")...");
- sendCommand(ble, addr.getBytes());
-
- Thread.sleep(1000);
-
- // query the module address
- String pin = "AT+PASS?";
- System.out.println("Querying module pin (" + pin + ")...");
- sendCommand(ble, pin.getBytes());
-
- // Other potentially useful commands are:
- //
- // AT+VERS? - query module version
- // AT+ROLE0 - set as slave
- // AT+ROLE1 - set as master
- // AT+CLEAR - clear all previous settings
- // AT+RESET - restart the device
- //
- // A comprehensive list is available from the datasheet at:
- // http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
-
- }
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/HMTRPSample.java b/peripheral/libupm/examples/java/HMTRPSample.java
deleted file mode 100644
index a3d24bd..0000000
--- a/peripheral/libupm/examples/java/HMTRPSample.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class HMTRPSample {
-
- static private final int bufferLength = 255;
-
- private static void printUsage() {
- System.out.println("Usage:");
- System.out.println("Pass a commandline argument (any argument) to this program");
- System.out.println("to query the radio configuration and output it. NOTE: the");
- System.out.println("radio must be in CONFIG mode for this to work.");
- System.out.println("Running this program without arguments will simply transmit");
- System.out.println("'Hello World!' every second, and output any data received from");
- System.out.println("another radio.");
- }
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a HMTRP radio device on uart 0
- upm_hmtrp.HMTRP radio = new upm_hmtrp.HMTRP(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!radio.setupTty()) {
- System.err.println("Failed to setup tty port parameters");
- System.exit(-1);
- }
- printUsage();
-
- // By default, this radio simply transmits data sent via writeData()
- // and reads any available data via readData().
-
- // It can be placed into a configuration mode by grounding the
- // CONFIG pin on the module. When this is done, the various
- // configuration query and config methods can be used. In this
- // example, by default, we just read any data available fom the
- // device, and periodically transmit "Hello World".
-
- // If any argument was specified on the command line, do a simple
- // configuration query and output the results. The radio must be in·
- // CONFIG mode for this to work.
-
- if (args.length > 0) {
- // config mode
- long[] freq = {0};
- long[] dataRate = {0};
- int[] rxBandwidth = {0};
- short[] modulation = {0};
- short[] txPower = {0};
- long[] uartBaud = {0};
-
- if (radio.getConfig(freq, dataRate, rxBandwidth, modulation, txPower, uartBaud)) {
- System.out.println("Radio configuration:");
- System.out.println("freq: " + freq[0] + " dataRate: " + dataRate[0]
- + " rxBandwidth: " + rxBandwidth[0] + "Khz");
- System.out.println("modulation: " + modulation[0] + "Khz txPower: " + txPower[0]
- + " uartBaud: " + uartBaud[0]);
- } else {
- System.err.println("getConfig() failed. Make sure the radio is in CONFIG mode.");
- }
- } else {
- // normal read/write mode
- byte[] radioBuffer = new byte[bufferLength];
- byte[] hello = "Hello World".getBytes();
- int counter = 0;
-
- System.out.println("Running in normal read/write mode.");
-
- while (true) {
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (radio.dataAvailable()) {
- int rv = radio.readData(radioBuffer);
-
- if (rv > 0) {
- System.out.print("Received: ");
- for (int i = 0; i < radioBuffer.length; i++)
- System.out.print((char) radioBuffer[i]);
- System.out.println();
- } else {
- System.err.println("Port read error.");
- break;
- }
- continue;
- }
-
- Thread.sleep(100);
-
- counter++;
- // every second, transmit "Hello World!"
- if (counter > 10) {
- System.out.println("Transmitting hello world...");
- radio.writeData(hello);
- counter = 0;
- }
- }
- }
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/HP20xExample.java b/peripheral/libupm/examples/java/HP20xExample.java
deleted file mode 100644
index 8082031..0000000
--- a/peripheral/libupm/examples/java/HP20xExample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_hp20x.HP20X;
-
-public class HP20xExample {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- //! [Interesting]
- // Instantiate the sensor on the default I2C bus and sensor
- HP20X hp20x = new HP20X();
-
- // Initializing the sensor with the default values
- hp20x.init();
-
- while(true){
- System.out.println("Temperature: "+hp20x.getTemperature()+"\tPressure: "+hp20x.getPressure()+"\tAltitude: "+hp20x.getAltitude());
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/HTU21DSample.java b/peripheral/libupm/examples/java/HTU21DSample.java
deleted file mode 100644
index 33ad1a2..0000000
--- a/peripheral/libupm/examples/java/HTU21DSample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class HTU21DSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- float humidity = 0;
- float temperature = 0;
- float compRH = 0;
-
- upm_htu21d.HTU21D sensor = new upm_htu21d.HTU21D(0);
- sensor.testSensor();
-
- while (true) {
- compRH = sensor.getCompRH();
- humidity = sensor.getHumidity();
- temperature = sensor.getTemperature();
-
- System.out.println("Humidity: " + humidity + ", Temperature: " + temperature
- + ", compensated RH: " + compRH);
-
- Thread.sleep(5000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Hmc5883lSample.java b/peripheral/libupm/examples/java/Hmc5883lSample.java
deleted file mode 100644
index c16439c..0000000
--- a/peripheral/libupm/examples/java/Hmc5883lSample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class Hmc5883lSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate on I2C
- upm_hmc5883l.Hmc5883l compas = new upm_hmc5883l.Hmc5883l(0);
-
- short[] pos;
-
- // Set your declination from true north in radians
- compas.set_declination(0.2749f);
-
- while (true) {
- // Update the coordinates
- compas.update();
-
- pos = compas.coordinates();
- System.out.println("Coor: " + pos[0] + " " + pos[1] + " " + pos[2]);
- System.out.println("Heading: " + compas.heading() + " Direction:" + compas.direction());
-
- Thread.sleep(2000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Itg3200Sample.java b/peripheral/libupm/examples/java/Itg3200Sample.java
deleted file mode 100644
index 9edaa92..0000000
--- a/peripheral/libupm/examples/java/Itg3200Sample.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class Itg3200Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- short[] rot;
- float[] ang;
-
- // Note: Sensor not supported on Intel Edison with Arduino breakout
- upm_itg3200.Itg3200 gyro = new upm_itg3200.Itg3200(0);
-
- while (true) {
- gyro.update();
- rot = gyro.getRawValues();
- ang = gyro.getRotation();
-
- System.out.println("Raw Values: X: " + rot[0] + " Y: " + rot[1] + " Z: " + rot[2]);
- System.out.println("Angular Velocities: X: " + ang[0] + " Y: " + ang[1] + " Z: "
- + ang[2]);
-
- System.out.println("Temp: " + gyro.getTemperature() + ", Raw: " + gyro.getRawTemp());
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Jhd1313m1Sample.java b/peripheral/libupm/examples/java/Jhd1313m1Sample.java
deleted file mode 100644
index db84426..0000000
--- a/peripheral/libupm/examples/java/Jhd1313m1Sample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class Jhd1313m1Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_i2clcd.Jhd1313m1 lcd = new upm_i2clcd.Jhd1313m1(0);
-
- lcd.setCursor(0, 0);
- lcd.write("Hello World");
- lcd.setCursor(1, 2);
- lcd.write("Hello World");
-
- System.out.println("Sleeping for 5 seconds");
- Thread.sleep(5000);
- lcd.clear();
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java b/peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java
deleted file mode 100644
index bda1994..0000000
--- a/peripheral/libupm/examples/java/Jhd1313m1_lcdSample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class Jhd1313m1_lcdSample{
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- upm_i2clcd.Jhd1313m1 lcd = new upm_i2clcd.Jhd1313m1(1, 0x3E, 0x62);
-
- lcd.setCursor(0,0);
- lcd.write("Hello World");
- lcd.setCursor(1,2);
- lcd.write("Hello World");
-
- System.out.println("Sleeping for 5 seconds");
- Thread.sleep(5000);
- lcd.clear();
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/Joystick12Sample.java b/peripheral/libupm/examples/java/Joystick12Sample.java
deleted file mode 100644
index 31660bc..0000000
--- a/peripheral/libupm/examples/java/Joystick12Sample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class Joystick12Sample {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- // Instantiate a joystick on analog pins A0 and A1
- upm_joystick12.Joystick12 joystick = new upm_joystick12.Joystick12(0,1);
-
- // Print the X and Y input values every second
- while(true){
- float x = joystick.getXInput();
- float y = joystick.getYInput();
-
- System.out.println("Driving X: " + x + " , and Y: " + y );
-
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/Joystick12_exampleSample.java b/peripheral/libupm/examples/java/Joystick12_exampleSample.java
deleted file mode 100644
index 442d59c..0000000
--- a/peripheral/libupm/examples/java/Joystick12_exampleSample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class Joystick12_exampleSample {
-
- public static void main(String[] args) throws InterruptedException {
- //! [Interesting]
- // Instantiate a joystick on analog pins A0 and A1
- upm_joystick12.Joystick12 joystick = new upm_joystick12.Joystick12(0,1);
-
- // Print the X and Y input values every second
- while(true){
- float x = joystick.getXInput();
- float y = joystick.getYInput();
-
- System.out.println("Driving X: " + x + " , and Y: " + y );
-
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/LDT0028Sample.java b/peripheral/libupm/examples/java/LDT0028Sample.java
deleted file mode 100644
index 0d3970e..0000000
--- a/peripheral/libupm/examples/java/LDT0028Sample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class LDT0028Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
-
- // Create the LDT0-028 Piezo Vibration Sensor object using AIO pin 0
- upm_ldt0028.LDT0028 sensor = new upm_ldt0028.LDT0028(0);
-
- System.out.println("Sensor name: " + sensor.name());
-
- while (true) {
- System.out.println("Sample value: " + sensor.getSample());
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/LSM303Sample.java b/peripheral/libupm/examples/java/LSM303Sample.java
deleted file mode 100644
index 3644e02..0000000
--- a/peripheral/libupm/examples/java/LSM303Sample.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class LSM303Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate LSM303 compass on I2C
- upm_lsm303.LSM303 sensor = new upm_lsm303.LSM303(0);
-
- // Get the coordinate data
- sensor.getCoordinates();
- short[] coor = sensor.getRawCoorData(); // in XYZ order.·
- // The sensor returns XZY, but the driver compensates and makes it XYZ
-
- // Print out the X, Y, and Z coordinate data using two different methods
- System.out.println("coor: rX " + coor[0] + " - rY " + coor[1] + " - rZ " + coor[2]);
- System.out.println("coor: gX " + sensor.getCoorX() + " - gY " + sensor.getCoorY()
- + " - gZ " + sensor.getCoorZ());
-
- // Get and print out the heading
- System.out.println("heading: " + sensor.getHeading());
-
- // Get the acceleration
- sensor.getAcceleration();
- short[] accel = sensor.getRawAccelData();
-
- // Print out the X, Y, and Z acceleration data using two different
- // methods
- System.out.println("acc: rX " + accel[0] + " - rY " + accel[1] + " - rZ " + accel[2]);
- System.out.println("acc: gX " + sensor.getAccelX() + " - gY " + sensor.getAccelY()
- + " - gZ " + sensor.getAccelZ());
-
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Lcm1602_i2cSample.java b/peripheral/libupm/examples/java/Lcm1602_i2cSample.java
deleted file mode 100644
index 53b8ba4..0000000
--- a/peripheral/libupm/examples/java/Lcm1602_i2cSample.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class Lcm1602_i2cSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_i2clcd.Lcm1602 lcd = new upm_i2clcd.Lcm1602(0, 0x27);
-
- lcd.setCursor(0, 0);
- lcd.write("Hello World");
- Thread.sleep(3000);
-
- lcd.setCursor(1, 2);
- lcd.write("Hello World");
- Thread.sleep(3000);
-
- lcd.setCursor(2, 4);
- lcd.write("Hello World");
- Thread.sleep(3000);
-
- lcd.setCursor(3, 6);
- lcd.write("Hello World");
- Thread.sleep(3000);
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Lcm1602_parallelSample.java b/peripheral/libupm/examples/java/Lcm1602_parallelSample.java
deleted file mode 100644
index e720d23..0000000
--- a/peripheral/libupm/examples/java/Lcm1602_parallelSample.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class Lcm1602_parallelSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // LCD connection:
- // LCD RS pin to digital pin 8
- // LCD Enable pin to digital pin 13
- // LCD D4 pin to digital pin 2
- // LCD D5 pin to digital pin 3
- // LCD D6 pin to digital pin 4
- // LCD D7 pin to digital pin 5
- // LCD R/W pin to ground
- // 10K trimmer potentiometer:
- // ends to +5V and ground
- // wiper to LCD VO pin (pin 3)
- upm_i2clcd.Lcm1602 lcd = new upm_i2clcd.Lcm1602((short) 8, (short) 13, (short) 2, (short) 3, (short) 4, (short) 5, (short) 20, (short) 2);
-
- lcd.setCursor(0, 0);
- lcd.write("Hello World");
- lcd.setCursor(1, 2);
- lcd.write("Hello World");
-
- System.out.println("Sleeping for 5 seconds");
- Thread.sleep(5000);
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/LoLSample.java b/peripheral/libupm/examples/java/LoLSample.java
deleted file mode 100644
index c37a6ca..0000000
--- a/peripheral/libupm/examples/java/LoLSample.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class LoLSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_lol.LoL sensor = new upm_lol.LoL();
-
- int x = 0, y = 0;
- while (true) {
- // revert pixel
- sensor.setPixel(x, y, sensor.getPixel(x, y));
-
- if (++x == 13) {
- x = 0;
- y++;
- }
- if (y == 9)
- y = 0;
- Thread.sleep(10);
- }
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/LoL_exampleSample.java b/peripheral/libupm/examples/java/LoL_exampleSample.java
deleted file mode 100644
index b6d2bf3..0000000
--- a/peripheral/libupm/examples/java/LoL_exampleSample.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class LoL_exampleSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_lol.LoL sensor = new upm_lol.LoL();
-
- int x = 0, y = 0;
- while (true) {
- // revert pixel
- sensor.setPixel(x, y, sensor.getPixel(x, y));
-
- if (++x == 13) {
- x = 0;
- y++;
- }
- if (y == 9)
- y = 0;
- Thread.sleep(10);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/M24LR64ESample.java b/peripheral/libupm/examples/java/M24LR64ESample.java
deleted file mode 100644
index a0152a1..0000000
--- a/peripheral/libupm/examples/java/M24LR64ESample.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class M24LR64ESample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate an M24LR64E on I2C bus 0
- upm_m24lr64e.M24LR64E nfcTag = new upm_m24lr64e.M24LR64E(0);
-
- // This example accesses the device in the 'user' (default) mode,
- // reads the last byte of data in the EEPROM, inverts it, writes
- // it back, and then re-reads it.
-
- // Read the last byte of the EEPROM area
- int addr = upm_m24lr64e.M24LR64E.EEPROM_I2C_LENGTH - 1;
- System.out.println("Address: " + addr);
- short read = nfcTag.readByte(addr);
- System.out.println("Read: " + read);
-
- // Now change it to it's opposite and write it
- read = (short) (~read & 0xff);
- nfcTag.writeByte(addr, read);
- System.out.println("Wrote: " + read);
-
- // Now read it back
- read = nfcTag.readByte(addr);
- System.out.println("Read: " + read);
-
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MAX44000Sample.java b/peripheral/libupm/examples/java/MAX44000Sample.java
deleted file mode 100644
index 67e7e03..0000000
--- a/peripheral/libupm/examples/java/MAX44000Sample.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class MAX44000Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_max44000.MAX44000 sensor = new upm_max44000.MAX44000(0);
-
- while (true) {
- System.out.println("proximity value = " + sensor.getAmbient());
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MHZ16Sample.java b/peripheral/libupm/examples/java/MHZ16Sample.java
deleted file mode 100644
index 9059a23..0000000
--- a/peripheral/libupm/examples/java/MHZ16Sample.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class MHZ16Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a MHZ16 serial CO2 sensor on uart 0.
- upm_mhz16.MHZ16 co2 = new upm_mhz16.MHZ16(0);
-
- System.out.println("Make sure that the sensor has had at least 3 minutes to warm up");
- System.out.println("or you will not get valid results.");
- System.out.println("The temperature reported is not the ambient temperature,");
- System.out.println("but rather the temperature of the sensor elements.");
-
- while (true) {
- if (!co2.getData()) {
- System.out.println("Failed to retrieve data");
- continue;
- }
- System.out.println("CO2 concentration: " + co2.getGas() + "PPM, Temperature (in C): "
- + co2.getTemperature());
-
- Thread.sleep(2000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MMA7455Sample.java b/peripheral/libupm/examples/java/MMA7455Sample.java
deleted file mode 100644
index 08ee897..0000000
--- a/peripheral/libupm/examples/java/MMA7455Sample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class MMA7455Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_mma7455.MMA7455 sensor = new upm_mma7455.MMA7455(0);
- short[] val;
-
- while (true) {
- val = sensor.readData();
- System.out.println("Accelerometer X: " + val[0] + ", Y: " + val[1] + ", Z: " + val[2]);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MMA7660Sample.java b/peripheral/libupm/examples/java/MMA7660Sample.java
deleted file mode 100644
index 77736e2..0000000
--- a/peripheral/libupm/examples/java/MMA7660Sample.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class MMA7660Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate an MMA7660 on I2C bus 0
- upm_mma7660.MMA7660 accel = new upm_mma7660.MMA7660(0);
-
- // place device in standby mode so we can write registers
- accel.setModeStandby();
-
- // enable 64 samples per second
- accel.setSampleRate(upm_mma7660.MMA7660.MMA7660_AUTOSLEEP_T.AUTOSLEEP_64);
-
- // place device into active mode
- accel.setModeActive();
-
- while (true) {
- int[] rawValues = accel.getRawValues();
- System.out.println("Raw Values: x = " + rawValues[0] + " y = " + rawValues[1] + " x = "
- + rawValues[2]);
-
- float[] acceleration = accel.getAcceleration();
- System.out.println("Raw Values: x = " + acceleration[0] + " y = " + acceleration[1]
- + " x = " + acceleration[2]);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MPL3115A2Sample.java b/peripheral/libupm/examples/java/MPL3115A2Sample.java
deleted file mode 100644
index 8f5b877..0000000
--- a/peripheral/libupm/examples/java/MPL3115A2Sample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class MPL3115A2Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a MPL3115A2 sensor on I2C
- upm_mpl3115a2.MPL3115A2 sensor = new upm_mpl3115a2.MPL3115A2(0);
-
- while (true) {
- System.out.println("Pressure: " + sensor.getPressure());
- System.out.println("Altitude: " + sensor.getAltitude());
- System.out.println("Sealevel pressure: " + sensor.getSealevelPressure());
- System.out.println("Temperature: " + sensor.getTemperature());
- System.out.println();
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MPR121Sample.java b/peripheral/libupm/examples/java/MPR121Sample.java
deleted file mode 100644
index 37128b1..0000000
--- a/peripheral/libupm/examples/java/MPR121Sample.java
+++ /dev/null
@@ -1,34 +0,0 @@
-public class MPR121Sample {
-
- private static void printButtons(upm_mpr121.MPR121 touch) {
- boolean buttonPresed = false;
-
- System.out.print("Buttons pressed: ");
- for (int i = 0; i < 12; i++) {
- if ((touch.getM_buttonStates() & (1 << i)) != 0) {
- System.out.print(i + " ");
- buttonPresed = true;
- }
- }
-
- if (!buttonPresed)
- System.out.print("None ");
-
- System.out.println();
- }
-
- public static void main(String[] args) throws InterruptedException {
- // Instantiate an MPR121 on I2C bus 0
- upm_mpr121.MPR121 touch = new upm_mpr121.MPR121(0);
-
- // init according to AN3944 defaults
- touch.configAN3944();
-
- while (true) {
- touch.readButtons();
- printButtons(touch);
- Thread.sleep(1000);
- }
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MPU9150Sample.java b/peripheral/libupm/examples/java/MPU9150Sample.java
deleted file mode 100644
index a8de875..0000000
--- a/peripheral/libupm/examples/java/MPU9150Sample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class MPU9150Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_mpu9150.MPU9150 sensor = new upm_mpu9150.MPU9150();
-
- sensor.init();
-
- while (true) {
- sensor.update();
-
- float[] accel = sensor.getAccelerometer();
- System.out.println("Accelerometer: " + "AX: " + accel[0] + " AY: " + accel[1] + " AZ: "
- + accel[2]);
-
- float[] gyro = sensor.getGyroscope();
- System.out.println("Gryoscope: " + "GX: " + gyro[0] + " GY: " + gyro[1] + " GZ: "
- + gyro[2]);
-
- float[] magn = sensor.getMagnetometer();
- System.out.println("Magnetometer: " + "MX: " + magn[0] + " MY: " + magn[1] + " MZ: "
- + magn[2]);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MQ2Sample.java b/peripheral/libupm/examples/java/MQ2Sample.java
deleted file mode 100644
index fbad70a..0000000
--- a/peripheral/libupm/examples/java/MQ2Sample.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class MQ2Sample {
- private static final short resolution = 5;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- short[] buffer = new short[128];
-
- // Attach gas sensor to A0
- upm_gas.MQ2 sensor = new upm_gas.MQ2(0);
-
- upm_gas.thresholdContext ctx = new upm_gas.thresholdContext();
- ctx.setAverageReading(0);
- ctx.setRunningAverage(0);
- ctx.setAveragedOver(2);
-
- while (true) {
- int len = sensor.getSampledWindow(2, buffer);
-
- if (len != 0) {
- int thresh = sensor.findThreshold(ctx, 30, buffer);
- sensor.printGraph(ctx, resolution);
- if (thresh != 0) {
- System.out.println("---Threshold reached---");
- }
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MQ303ASample.java b/peripheral/libupm/examples/java/MQ303ASample.java
deleted file mode 100644
index 13365b4..0000000
--- a/peripheral/libupm/examples/java/MQ303ASample.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class MQ303ASample {
-
- public static void main(String[] args) throws InterruptedException {
- // Instantiate an mq303a sensor on analog pin A0
-
- // This device uses a heater powered from an analog I/O pin.·
- // If using A0 as the data pin, then you need to use A1, as the heater
- // pin (if using a grove mq303a). For A1, we can use the D15 gpio,·
- // setup as an output, and drive it low to power the heater.
- upm_mq303a.MQ303A mq303a = new upm_mq303a.MQ303A(1, 15);
-
- System.out.println("Enabling heater and waiting 2 minutes for warmup.");
- mq303a.heaterEnable(true);
- Thread.sleep(120000);
-
- System.out.println("This sensor may need to warm until the value drops below about 450.");
-
- for (int i = 1; i < 10; i++) {
- int val = mq303a.value();
- System.out.println("Alcohol detected (higher means stronger alcohol): " + val);
-
- Thread.sleep(1000);
- }
-
- mq303a.heaterEnable(false);
- System.out.println("Exiting");
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MQ5Sample.java b/peripheral/libupm/examples/java/MQ5Sample.java
deleted file mode 100644
index c2ae23d..0000000
--- a/peripheral/libupm/examples/java/MQ5Sample.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class MQ5Sample {
- private static final short resolution = 7;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- short[] buffer = new short[128];
-
- // Attach gas sensor to A0
- upm_gas.MQ5 sensor = new upm_gas.MQ5(0);
-
- upm_gas.thresholdContext ctx = new upm_gas.thresholdContext();
- ctx.setAverageReading(0);
- ctx.setRunningAverage(0);
- ctx.setAveragedOver(2);
-
- while (true) {
- int len = sensor.getSampledWindow(2, buffer);
-
- if (len != 0) {
- int thresh = sensor.findThreshold(ctx, 30, buffer);
- sensor.printGraph(ctx, resolution);
- if (thresh != 0) {
- System.out.println("---Threshold reached---");
- }
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/MicrophoneSample.java b/peripheral/libupm/examples/java/MicrophoneSample.java
deleted file mode 100644
index d59fc32..0000000
--- a/peripheral/libupm/examples/java/MicrophoneSample.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class MicrophoneSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- short[] buffer = new short[128];
-
- // Attach microphone to analog port A0
- upm_mic.Microphone sensor = new upm_mic.Microphone(0);
-
- upm_mic.thresholdContext ctx = new upm_mic.thresholdContext();
- ctx.setAverageReading(0);
- ctx.setRunningAverage(0);
- ctx.setAveragedOver(2);
-
- // Repeatedly, take a sample every 2 microseconds;
- // find the average of 128 samples; and
- // print a running graph of the averages
- while (true) {
- int len = sensor.getSampledWindow(2, buffer);
-
- if (len != 0) {
- int thresh = sensor.findThreshold(ctx, 30, buffer);
- sensor.printGraph(ctx);
- if (thresh != 0) {
- System.out.println("---Threshold reached--- " + ctx.getRunningAverage() + " "
- + ctx.getAverageReading());
- }
- }
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/NRF24L01_receiverSample.java b/peripheral/libupm/examples/java/NRF24L01_receiverSample.java
deleted file mode 100644
index c5dc481..0000000
--- a/peripheral/libupm/examples/java/NRF24L01_receiverSample.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_nrf24l01.Callback;
-
-//NOT TESTED!!!
-public class NRF24L01_receiverSample {
-
- static private final byte[] local_address = {0x01, 0x01, 0x01, 0x01, 0x01};
- static private final byte[] broadcast_address = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
- (byte) 0xFF, (byte) 0xFF};
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_nrf24l01.NRF24L01 comm = new upm_nrf24l01.NRF24L01((short) 7, (short) 8);
-
- Callback callback = new ReceiverCallback(comm);
-
- comm.setSourceAddress(local_address);
- comm.setDestinationAddress(broadcast_address);
- comm.setPayload((short) upm_nrf24l01.javaupm_nrf24l01Constants.MAX_BUFFER);
- comm.configure();
- comm.setSpeedRate(upm_nrf24l01.speed_rate_t.NRF_250KBPS);
- comm.setChannel((short) 99);
- comm.setDataReceivedHandler(callback);
-
- while (true) {
- comm.pollListener();
- }
-
- // ! [Interesting]
- }
-}
-
-class ReceiverCallback extends Callback {
-
- private upm_nrf24l01.NRF24L01 comm = null;
-
- public ReceiverCallback(upm_nrf24l01.NRF24L01 comm) {
- super();
- this.comm = comm;
- }
- public void run() {
- if (comm != null) {
- short[] rx_buffer = comm.getM_rxBuffer();
- System.out.print("Received: ");
- for (int i = 0; i < rx_buffer.length; i++)
- System.out.print(rx_buffer[i]);
- System.out.println();
- } else {
- System.out.println("No NRF24L01 instance given to callback");
- }
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/NRF24L01_transmitterSample.java b/peripheral/libupm/examples/java/NRF24L01_transmitterSample.java
deleted file mode 100644
index f2918f0..0000000
--- a/peripheral/libupm/examples/java/NRF24L01_transmitterSample.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_nrf24l01.Callback;
-
-//NOT TESTED!!!
-public class NRF24L01_transmitterSample {
-
- static private final byte[] destAddress = {0x01, 0x01, 0x01, 0x01, 0x01};
- static private final byte[] srcAddress = {0x01, 0x01, 0x01, 0x01, 0x01};
- static private byte[] tx_buffer = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
- 0x00};
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_nrf24l01.NRF24L01 comm = new upm_nrf24l01.NRF24L01((short) 7, (short) 8);
-
- Callback callback = new TransmitterCallback();
-
- comm.setSourceAddress(srcAddress);
- comm.setDestinationAddress(destAddress);
- comm.setPayload((short) upm_nrf24l01.javaupm_nrf24l01Constants.MAX_BUFFER);
- comm.setChannel((short) 99);
- comm.configure();
- comm.setDataReceivedHandler(callback);
-
- while (true) {
- comm.send(tx_buffer);
- System.out.println("devi2 :: sending data ....");
- for (int i = 0; i < tx_buffer.length; i++)
- System.out.print(tx_buffer[i]);
- System.out.println();
- Thread.sleep(3000);
- }
- // ! [Interesting]
- }
-}
-
-class TransmitterCallback extends Callback {
- public TransmitterCallback() {
- super();
- }
- public void run() {
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/NUNCHUCKSample.java b/peripheral/libupm/examples/java/NUNCHUCKSample.java
deleted file mode 100644
index 0a26d99..0000000
--- a/peripheral/libupm/examples/java/NUNCHUCKSample.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class NUNCHUCKSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a nunchuck controller bus 0
- upm_nunchuck.NUNCHUCK nunchuck = new upm_nunchuck.NUNCHUCK(0);
-
- // always do this first
- System.out.println("Initializing... ");
- if (!nunchuck.init()) {
- System.err.println("nunchuck->init() failed.");
- return;
- }
-
- while (true) {
- nunchuck.update();
- System.out.println("stickX: " + nunchuck.getStickX() + ", stickY: "
- + nunchuck.getStickY());
- System.out.println("accelX: " + nunchuck.getAccelX() + ", accelY: "
- + nunchuck.getAccelY() + ", accelZ: " + nunchuck.getAccelZ());
-
- if (nunchuck.getButtonC())
- System.out.println("Button C pressed");
- else
- System.out.println("Button C not pressed");
-
- if (nunchuck.getButtonZ())
- System.out.println("Button Z pressed");
- else
- System.out.println("Button Z not pressed");
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/OTP538USample.java b/peripheral/libupm/examples/java/OTP538USample.java
deleted file mode 100644
index 07b3ba9..0000000
--- a/peripheral/libupm/examples/java/OTP538USample.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class OTP538USample {
- private static final float OTP538U_AREF = 5;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a OTP538U on analog pins A0 and A1
- // A0 is used for the Ambient Temperature and A1 is used for the Object
- // temperature.
- upm_otp538u.OTP538U temps = new upm_otp538u.OTP538U(0, 1, OTP538U_AREF);
-
- while (true) {
- System.out.println("Ambient temp: " + temps.ambientTemperature() + " C");
- System.out.println("Object temp: " + temps.objectTemperature() + " C");
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/PPD42NSSample.java b/peripheral/libupm/examples/java/PPD42NSSample.java
deleted file mode 100644
index 78d0628..0000000
--- a/peripheral/libupm/examples/java/PPD42NSSample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class PPD42NSSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a dust sensor on GPIO pin D8
- upm_ppd42ns.PPD42NS dust = new upm_ppd42ns.PPD42NS(8);
- upm_ppd42ns.dustData data;
-
- System.out.println("This program will give readings every 30 seconds until you stop it");
-
- while (true) {
- data = dust.getData();
-
- System.out.println("Low pulse occupancy: " + data.getLowPulseOccupancy());
- System.out.println("Ratio: " + data.getRatio());
- System.out.println("Concentration: " + data.getConcentration());
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/PulsensorSample.java b/peripheral/libupm/examples/java/PulsensorSample.java
deleted file mode 100644
index fb1e85b..0000000
--- a/peripheral/libupm/examples/java/PulsensorSample.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Andrei Vasiliu <andrei.vasiliu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_pulsensor.*;
-
-public class PulsensorSample {
- static class PulsensorCallback extends Callback {
- public PulsensorCallback() {
- super();
- }
- public void run (clbk_data arg) {
- System.out.println();
- }
- }
-
- public static void main (String[] args) throws InterruptedException {
- // ! [Interesting]
- Callback obj_call = new PulsensorCallback();
- Pulsensor p = new Pulsensor(obj_call);
- p.start_sampler();
- Thread.sleep(1000);
- p.stop_sampler();
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/RFR359FSample.java b/peripheral/libupm/examples/java/RFR359FSample.java
deleted file mode 100644
index 0c286de..0000000
--- a/peripheral/libupm/examples/java/RFR359FSample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class RFR359FSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate an RFR359F digital pin D2
- upm_rfr359f.RFR359F dInterruptor = new upm_rfr359f.RFR359F(2);
-
- while (true) {
- if (dInterruptor.objectDetected()) {
- System.out.println("Object detected");
- } else {
- System.out.println("Area is clear!");
- }
-
- Thread.sleep(100);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/RPR220Sample.java b/peripheral/libupm/examples/java/RPR220Sample.java
deleted file mode 100644
index ae76be6..0000000
--- a/peripheral/libupm/examples/java/RPR220Sample.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class RPR220Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // This example uses a simple method to determine current status
-
- // Instantiate an RPR220 digital pin D2
- upm_rpr220.RPR220 sensor = new upm_rpr220.RPR220(2);
-
- while (true) {
- if (sensor.blackDetected())
- System.out.println("Black detected");
- else
- System.out.println("Black NOT detected");
-
- Thread.sleep(100);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/RPR220_intrSample.java b/peripheral/libupm/examples/java/RPR220_intrSample.java
deleted file mode 100644
index 1ea80b4..0000000
--- a/peripheral/libupm/examples/java/RPR220_intrSample.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class RPR220_intrSample {
-
- public static int counter = 0;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // This example uses an interrupt handler to increment a counter
-
- // Instantiate an RPR220 digital pin D2
- upm_rpr220.RPR220 sensor = new upm_rpr220.RPR220(2);
-
- RPRISR callback = new RPRISR();
- sensor.installISR(callback);
-
- while (true) {
- System.out.println("Counter: " + counter);
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-}
-
-class RPRISR implements Runnable {
- public RPRISR() {
- super();
- }
- public void run() {
- RPR220_intrSample.counter++;
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/RotaryEncoderSample.java b/peripheral/libupm/examples/java/RotaryEncoderSample.java
deleted file mode 100644
index 8272f57..0000000
--- a/peripheral/libupm/examples/java/RotaryEncoderSample.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class RotaryEncoderSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Grove Rotary Encoder, using signal pins D2 and D3
- upm_rotaryencoder.RotaryEncoder rotaryencoder = new upm_rotaryencoder.RotaryEncoder(2, 3);
-
- while (true) {
- System.out.println("Position: " + rotaryencoder.position());
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/SSD1308_oledSample.java b/peripheral/libupm/examples/java/SSD1308_oledSample.java
deleted file mode 100644
index c7a5bd3..0000000
--- a/peripheral/libupm/examples/java/SSD1308_oledSample.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class SSD1308_oledSample {
-
- static private final int[] IntelLogo = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192,
- 192, 192, 224, 224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60,
- 60, 62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31, 30, 62, 62, 62, 62,
- 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240, 224, 224, 224, 192, 128, 128,
- 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
- 128, 128, 128, 128, 128, 128, 128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1,
- 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 192,
- 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195, 195, 7, 15, 15, 63, 127,
- 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0, 0, 0, 0, 0, 0, 128, 192, 192, 240,
- 248, 124, 124, 60, 0, 0, 0, 0, 159, 159, 159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 0, 0, 0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
- 128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128, 128, 128,
- 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 3, 7, 3, 3,
- 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255, 255, 255, 0, 0, 224, 248, 252, 252,
- 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0,
- 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255,
- 255, 255, 255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
- 15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143, 135, 135, 143,
- 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255, 255, 255, 255, 255, 255,
- 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 224, 248, 248, 255, 255, 255, 255,
- 255, 127, 15, 255, 255, 255, 255, 255, 255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255,
- 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
- 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
- 255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255, 255, 255, 255,
- 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231, 231, 231, 199, 135, 0, 0,
- 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 224, 240, 248, 248, 252, 254,
- 255, 255, 255, 127, 63, 63, 31, 15, 7, 7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255,
- 240, 192, 192, 128, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7,
- 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7, 7, 7,
- 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7, 7, 3, 3, 3, 1, 1,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15, 31, 127, 127, 127, 255, 255,
- 252, 252, 252, 248, 240, 240, 240, 224, 224, 224, 192, 192, 192, 192, 128, 128, 128,
- 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192,
- 192, 192, 192, 224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252,
- 252, 254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 15,
- 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127, 127, 127, 255, 255, 255, 255, 254,
- 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
- 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127,
- 127, 127, 127, 127, 63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7,
- 3, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0};
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_i2clcd.SSD1308 lcd = new upm_i2clcd.SSD1308(0);
-
- byte[] image = new byte[IntelLogo.length];
- for (int i = 0; i < IntelLogo.length; i++)
- image[i] = (byte) IntelLogo[i];
-
- lcd.clear();
- lcd.draw(image);
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/SSD1327_oledSample.java b/peripheral/libupm/examples/java/SSD1327_oledSample.java
deleted file mode 100644
index defeea6..0000000
--- a/peripheral/libupm/examples/java/SSD1327_oledSample.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class SSD1327_oledSample {
-
- static private final int[] SeeedLogo = new int[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x04, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x03,
- 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xC0, 0x08,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x07, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x0F, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F,
- 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01,
- 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x18,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x38, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x80, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x01, 0xE0, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x3E, 0x0F, 0x80, 0x03, 0xE0, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x07,
- 0x80, 0x03, 0xE0, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x07, 0x80, 0x03,
- 0xE0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x07, 0x80, 0x03, 0xC1, 0xF0,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x87, 0xC0, 0x07, 0xC1, 0xF0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0F, 0x83, 0xC0, 0x07, 0x83, 0xE0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0F, 0xC3, 0xC0, 0x07, 0x87, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x07, 0xE1, 0xE0, 0x07, 0x0F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0,
- 0xE0, 0x0F, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF8, 0xF0, 0x0E,
- 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF8, 0x70, 0x1C, 0x3F, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x18, 0x7E, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x18, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x1F, 0x88, 0x21, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x0F, 0xC4, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0xE0, 0x0F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x3E,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x06, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
- 0x06, 0x00, 0x00, 0x60, 0x00, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xDF, 0xE1,
- 0x9F, 0xEC, 0x7E, 0xE6, 0x73, 0x9C, 0xE7, 0x39, 0xCE, 0x1C, 0xDF, 0xE1, 0xB9, 0xEC,
- 0xE7, 0xE0, 0x61, 0xD8, 0x66, 0x1B, 0x86, 0x1C, 0x06, 0x61, 0xB0, 0x6D, 0xC3, 0x7C,
- 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x0F, 0x86, 0x61, 0xB0, 0x6D, 0x83, 0x3E, 0x7F, 0xFF,
- 0xFF, 0xFF, 0x06, 0x07, 0xC6, 0x61, 0xB0, 0x6D, 0x83, 0xC3, 0x61, 0x18, 0x46, 0x03,
- 0x86, 0x18, 0x66, 0x61, 0xB0, 0x6D, 0xC3, 0xFE, 0x7F, 0x9F, 0xE7, 0xF9, 0xFE, 0x1F,
- 0xE6, 0x3F, 0x9F, 0xEC, 0xFE, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xC6, 0x3F,
- 0x9F, 0xEC, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x44, 0x00, 0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C,
- 0xF3, 0xCF, 0x70, 0x9E, 0x79, 0xE7, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7D, 0x9E, 0x68,
- 0x20, 0xB2, 0xC8, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9E, 0x6F, 0x20, 0xB2,
- 0xF9, 0xE7, 0x80, 0x00, 0x00, 0x00, 0x00, 0x46, 0x9A, 0x61, 0x20, 0xB2, 0xCB, 0x60,
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xF3, 0xCF, 0x30, 0x9E, 0x79, 0xE7, 0x90, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7C, 0x02, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00, 0xF8, 0x00, 0x00,
- 0x40, 0x40, 0x02, 0x00, 0x00, 0x83, 0x60, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x40, 0x60,
- 0xB7, 0x79, 0xE7, 0x81, 0xC7, 0x92, 0x70, 0x89, 0xE7, 0x9E, 0x78, 0x7C, 0xE2, 0xC9,
- 0x2C, 0x81, 0xCC, 0xD2, 0x40, 0xFB, 0x21, 0xB2, 0x48, 0x40, 0x62, 0xF9, 0x2C, 0x80,
- 0x8C, 0xD2, 0x40, 0x8B, 0xE7, 0xB0, 0x48, 0x40, 0xE2, 0xC9, 0x2C, 0x80, 0x84, 0xD2,
- 0x40, 0x8B, 0x2D, 0x92, 0x48, 0x7D, 0xB3, 0x79, 0x27, 0x80, 0x87, 0x9E, 0x40, 0x8D,
- 0xE7, 0x9E, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_i2clcd.SSD1327 lcd = new upm_i2clcd.SSD1327(0);
-
- // If you don't set the display to be white, the seeed logo will appear
- // jagged
- lcd.setGrayLevel((short) 12);
-
- byte[] image = new byte[SeeedLogo.length];
- for (int i = 0; i < SeeedLogo.length; i++)
- image[i] = (byte) SeeedLogo[i];
-
- lcd.draw(image);
-
- // Simple print hello world
- for (short i = 0; i < 12; i++) {
- lcd.setCursor(i, 0);
- lcd.setGrayLevel(i);
- lcd.write("Hello World");
- }
-
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/ST7735Sample.java b/peripheral/libupm/examples/java/ST7735Sample.java
deleted file mode 100644
index a866e98..0000000
--- a/peripheral/libupm/examples/java/ST7735Sample.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class ST7735Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_st7735.ST7735 lcd = new upm_st7735.ST7735((short) 7, (short) 4, (short) 9, (short) 8);
-
- lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_RED);
- lcd.refresh();
-
- lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_CYAN);
- lcd.refresh();
-
- lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_BLACK);
- lcd.refresh();
-
- lcd.drawLine((short) 10, (short) 10, (short) 10, (short) 100,
- upm_st7735.javaupm_st7735Constants.ST7735_MAGENTA);
- lcd.drawLine((short) 20, (short) 20, (short) 10, (short) 100,
- upm_st7735.javaupm_st7735Constants.ST7735_YELLOW);
- lcd.drawLine((short) 30, (short) 30, (short) 50, (short) 100,
- upm_st7735.javaupm_st7735Constants.ST7735_WHITE);
- lcd.refresh();
-
- lcd.drawPixel((short) 20, (short) 20, upm_st7735.javaupm_st7735Constants.ST7735_GREEN);
- lcd.refresh();
-
- lcd.drawTriangle((short) 50, (short) 50, (short) 80, (short) 80, (short) 60, (short) 90,
- upm_st7735.javaupm_st7735Constants.ST7735_GREEN);
- lcd.refresh();
-
- lcd.drawCircle((short) 100, (short) 110, (short) 10,
- upm_st7735.javaupm_st7735Constants.ST7735_BLUE);
- lcd.refresh();
-
- lcd.setTextWrap((short) 0);
-
- lcd.setCursor((short) 0, (short) 30);
- lcd.setTextColor(upm_st7735.javaupm_st7735Constants.ST7735_RED,
- upm_st7735.javaupm_st7735Constants.ST7735_RED);
- lcd.setTextSize((short) 1);
- lcd.print("Hello World!");
-
- lcd.setCursor((short) 10, (short) 50);
- lcd.setTextColor(upm_st7735.javaupm_st7735Constants.ST7735_RED,
- upm_st7735.javaupm_st7735Constants.ST7735_YELLOW);
- lcd.setTextSize((short) 2);
- lcd.print("BIG");
-
- lcd.refresh();
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/StepMotorSample.java b/peripheral/libupm/examples/java/StepMotorSample.java
deleted file mode 100644
index 88cbe5a..0000000
--- a/peripheral/libupm/examples/java/StepMotorSample.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class StepMotorSample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_stepmotor.StepMotor sensor = new upm_stepmotor.StepMotor(2, 3);
-
- while (true) {
- System.out.println("One complete rotation forward and back at 60 rpm.");
- sensor.setSpeed(60);
- sensor.stepForward(200);
- Thread.sleep(1000);
- sensor.stepBackward(200);
- Thread.sleep(1000);
-
- System.out.println("One complete rotation forward and back at 150 rpm.");
- sensor.setSpeed(150);
- sensor.stepForward(200);
- Thread.sleep(1000);
- sensor.stepBackward(200);
- Thread.sleep(1000);
-
- System.out.println("One complete rotation forward and back at 300 rpm.");
- sensor.setSpeed(300);
- sensor.stepForward(200);
- Thread.sleep(1000);
- sensor.stepBackward(200);
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-}
diff --git a/peripheral/libupm/examples/java/TM1637Sample.java b/peripheral/libupm/examples/java/TM1637Sample.java
deleted file mode 100644
index 840b969..0000000
--- a/peripheral/libupm/examples/java/TM1637Sample.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import java.time.LocalDateTime;
-
-//NOT TESTED!!!
-public class TM1637Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // TM1637 on pins 0 (clk) and 1 (dio)
- upm_tm1637.TM1637 myDisplay = new upm_tm1637.TM1637(0, 1);
-
- // Start a box using 7-segment encoding
- myDisplay.write(0x39, 0x09, 0x09);
-
- // Finish box using writeAt function
- myDisplay.writeAt(3, ']');
-
- // Wait 3 seconds
- Thread.sleep(3000);
-
- LocalDateTime now;
- while (true) {
- now = LocalDateTime.now();
- int hour = now.getHour();
- int min = now.getMinute();
- int sec = now.getSecond();
-
- System.out.println(hour + ":" + min + ":" + sec);
- myDisplay.writeString(hour + ":" + min);
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/TP401Sample.java b/peripheral/libupm/examples/java/TP401Sample.java
deleted file mode 100644
index 89ac2b1..0000000
--- a/peripheral/libupm/examples/java/TP401Sample.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class TP401Sample {
- private static String airQuality(int value) {
- if (value < 50)
- return "Fresh Air";
- if (value < 200)
- return "Normal Indoor Air";
- if (value < 400)
- return "Low Pollution";
- if (value < 600)
- return "High Pollution - Action Recommended";
- return "Very High Pollution - Take Action Immediately";
- }
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate new grove air quality sensor on analog pin A0
- upm_gas.TP401 airSensor = new upm_gas.TP401(0);
-
- System.out.println(airSensor.name());
-
- System.out.println("Heating sensor for 3 minutes...");
- // wait 3 minutes for sensor to warm up
- for (int i = 0; i < 3; i++) {
- if (i != 0)
- System.out.println("Please wait, " + i + " minute(s) passed..");
- Thread.sleep(60000);
- }
- System.out.println("Sensor ready!");
-
- while (true) {
- int value = airSensor.getSample(); // Read raw value
- float ppm = airSensor.getPPM(); // Read CO ppm (can vary slightly
- // from previous read)
-
- System.out.println("raw: " + value + " ppm: " + ppm + " " + airQuality(value));
-
- Thread.sleep(100);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/TSL2561Sample.java b/peripheral/libupm/examples/java/TSL2561Sample.java
deleted file mode 100644
index d366446..0000000
--- a/peripheral/libupm/examples/java/TSL2561Sample.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class TSL2561Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a TSL2561 Digital Light Sensor on I2C
- upm_tsl2561.TSL2561 sensor = new upm_tsl2561.TSL2561();
-
- while (true) {
- System.out.println("Lux = " + sensor.getLux());
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/TTP223Sample.java b/peripheral/libupm/examples/java/TTP223Sample.java
deleted file mode 100644
index 394efb5..0000000
--- a/peripheral/libupm/examples/java/TTP223Sample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class TTP223Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- upm_ttp223.TTP223 touch = new upm_ttp223.TTP223(7);
-
- while (true) {
- if (touch.isPressed())
- System.out.println(touch.name() + " is pressed");
- else
- System.out.println(touch.name() + " is not pressed");
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Th02Example.java b/peripheral/libupm/examples/java/Th02Example.java
deleted file mode 100644
index f2a97c4..0000000
--- a/peripheral/libupm/examples/java/Th02Example.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-* Author: Abhishek Malik <abhishek.malik@intel.com>
-* Copyright (c) 2016 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-import upm_th02.TH02;
-
-public class Th02Example {
-
- static {
- try {
- System.loadLibrary("javaupm_th02");
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- float temperature = 0;
- float humidity = 0;
-
- TH02 sensor = new TH02();
- while(true){
- temperature = sensor.getTemperature();
- humidity = sensor.getHumidity();
- System.out.println("Temperature = "+temperature+", Humidity = "+humidity);
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception has occured: "+e.getMessage());
- }
- }
- }
-
-}
diff --git a/peripheral/libupm/examples/java/ULN200XASample.java b/peripheral/libupm/examples/java/ULN200XASample.java
deleted file mode 100644
index 81f97ad..0000000
--- a/peripheral/libupm/examples/java/ULN200XASample.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class ULN200XASample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Stepper motor on a ULN200XA Dual H-Bridge.
- // Wire the pins so that I1 is pin D8, I2 is pin D9, I3 is pin D10 and
- // I4 is pin D11
- upm_uln200xa.ULN200XA uln200xa = new upm_uln200xa.ULN200XA(4096, 8, 9, 10, 11);
-
- uln200xa.setSpeed(5);
- System.out.println("Rotating 1 revolution clockwise.");
- uln200xa.setDirection(upm_uln200xa.ULN200XA.ULN200XA_DIRECTION_T.DIR_CW);
- uln200xa.stepperSteps(4096);
-
- System.out.println("Sleeping for 2 seconds...");
- Thread.sleep(2000);
-
- System.out.println("Rotating 1/2 revolution counter clockwise.");
- uln200xa.setDirection(upm_uln200xa.ULN200XA.ULN200XA_DIRECTION_T.DIR_CCW);
- uln200xa.stepperSteps(2048);
-
- // turn off the power
- uln200xa.release();
- // ! [Interesting]
-
- System.out.println("Exiting...");
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/Ublox6Sample.java b/peripheral/libupm/examples/java/Ublox6Sample.java
deleted file mode 100644
index b7c5017..0000000
--- a/peripheral/libupm/examples/java/Ublox6Sample.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class Ublox6Sample {
- private static final int BUFFERLENGTH = 256;
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a Ublox6 GPS device on uart 0
- upm_ublox6.Ublox6 nmea = new upm_ublox6.Ublox6(0);
-
- // make sure port is initialized properly. 9600 baud is the default.
- if (!nmea.setupTty()) {
- throw new RuntimeException("Failed to setup tty port parameters");
- }
-
- // Collect and output NMEA data. There are various libraries out on
- // the Internet, that can handle decoding NMEA data and presenting
- // it in a more easily accessible format. This example will just
- // check for, and read raw NMEA data from the device and output it
- // on standard output.
-
- // This device also supports numerous configuration options, which
- // you can set with writeData(). Please refer to the Ublox-6 data
- // sheet for further information on the formats of the data sent and
- // received, and the various operating modes available.
-
- byte[] nmeaBuffer = new byte[BUFFERLENGTH];
-
- while (true) {
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (nmea.dataAvailable()) {
- int rv = nmea.readData(nmeaBuffer);
-
- if (rv > 0)
- for (int i = 0; i < rv; i++)
- System.out.print((char) nmeaBuffer[i]);
-
- if (rv < 0) { // some sort of read error occurred
- System.err.println("Port read error.");
- break;
- }
- continue;
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/WT5001Sample.java b/peripheral/libupm/examples/java/WT5001Sample.java
deleted file mode 100644
index 2266b3d..0000000
--- a/peripheral/libupm/examples/java/WT5001Sample.java
+++ /dev/null
@@ -1,130 +0,0 @@
-import java.io.IOException;
-
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class WT5001Sample {
-
- static private void printUsage() {
- System.out.println("Usage: java WT5001Sample <command>");
- System.out.println("Commands:");
- System.out.println("0 - stop playing");
- System.out.println("1 - start playing track 1");
- System.out.println("2 - pause/un-pause playback");
- System.out.println("3 - next track");
- System.out.println("4 - previous track");
- }
-
- public static void main(String[] args) {
- // ! [Interesting]
- // Instantiate a WT5001 serial MP3 player on uart 0
- upm_wt5001.WT5001 mp3 = new upm_wt5001.WT5001(0);
-
- int cmd = -1;
- if (args.length > 0)
- cmd = Integer.parseInt(args[0]);
-
- // make sure port is initialized properly. 9600 baud is the default
- if (!mp3.setupTty()) {
- System.err.println("error in loading native library");
- System.exit(-1);
- }
-
- switch (cmd) {
- case 0 :
- mp3.stop();
- break;
-
- case 1 :
- mp3.play(upm_wt5001.WT5001.WT5001_PLAYSOURCE_T.SD, 1);
- break;
-
- case 2 :
- mp3.pause();
- break;
-
- case 3 :
- mp3.next();
- break;
-
- case 4 :
- mp3.previous();
- break;
-
- default :
- // nothing, just output usage, and info below
- printUsage();
- break;
- }
-
- // print out some information
- try {
- short vol;
- vol = mp3.getVolume();
- System.out.println("The current volume is: " + vol);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- try {
- short ps;
- ps = mp3.getPlayState();
- System.out.println("The current play state is: " + ps);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- try {
- int numf;
- numf = mp3.getNumFiles(upm_wt5001.WT5001.WT5001_PLAYSOURCE_T.SD);
- System.out.println("The number of files on the SD card is: " + numf);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- try {
- int curf;
- curf = mp3.getCurrentFile();
- System.out.println("The current file is: " + curf);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- int year[] = new int[1];
- short month[] = new short[1];
- short day[] = new short[1];
- if (mp3.getDate(year, month, day))
- System.out.println("The device date is: " + year[0] + "/" + month[0] + "/" + day[0]);
-
- short hour[] = new short[1];
- short minute[] = new short[1];
- short second[] = new short[1];
- if (mp3.getTime(hour, minute, second))
- System.out
- .println("The device time is: " + hour[0] + ":" + minute[0] + ":" + second[0]);
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/WaterLevelSensor.java b/peripheral/libupm/examples/java/WaterLevelSensor.java
deleted file mode 100644
index d08aaee..0000000
--- a/peripheral/libupm/examples/java/WaterLevelSensor.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Author: Abhishek Malik <abhishek.malik@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import upm_waterlevel.WaterLevel;
-
-public class WaterLevelSensor {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //! [Interesting]
- // Instantiating the sensor on Digital Pin 2
- WaterLevel level = new WaterLevel(2);
-
- while(true){
- if(level.isSubmerged()){
- System.out.println("The sensor is submerged");
- }
- else{
- System.out.println("The sensor is above water level");
- }
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- System.out.println("The following exception occured: "+e.getMessage());
- }
- }
- //! [Interesting]
- }
-
-}
diff --git a/peripheral/libupm/examples/java/YG1006Sample.java b/peripheral/libupm/examples/java/YG1006Sample.java
deleted file mode 100644
index b994829..0000000
--- a/peripheral/libupm/examples/java/YG1006Sample.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class YG1006Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a yg1006 flame sensor on digital pin D2
- upm_yg1006.YG1006 flame = new upm_yg1006.YG1006(2);
-
- while (true) {
- boolean val = flame.flameDetected();
- if (val) {
- System.out.println("Flame detected");
- } else {
- System.out.println("No flame detected");
- }
-
- Thread.sleep(1000);
- }
- // ! [Interesting]
- }
-
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/java/ZFM20Sample.java b/peripheral/libupm/examples/java/ZFM20Sample.java
deleted file mode 100644
index 3a36b84..0000000
--- a/peripheral/libupm/examples/java/ZFM20Sample.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Author: Stefan Andritoiu <stefan.andritoiu@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//NOT TESTED!!!
-public class ZFM20Sample {
-
- public static void main(String[] args) throws InterruptedException {
- // ! [Interesting]
- // Instantiate a ZFM20 Fingerprint reader on UART 0
- upm_zfm20.ZFM20 fp = new upm_zfm20.ZFM20(0);
-
- // make sure port is initialized properly. 57600 baud is the default
- if (!fp.setupTty()) {
- System.err.println("Failed to setup tty port parameters");
- System.exit(-1);
- }
-
- // first, set the default password and address
- fp.setPassword(upm_zfm20.javaupm_zfm20.ZFM20_DEFAULT_PASSWORD);
- fp.setAddress(upm_zfm20.javaupm_zfm20.ZFM20_DEFAULT_ADDRESS);
-
- // now verify the password. If this fails, any other commands
- // will be ignored, so we just bail.
- if (fp.verifyPassword()) {
- System.out.println("Password verified.");
- } else {
- System.err.println("Password verification failed.");
- System.exit(-1);
- }
-
- // how many valid stored templates (fingerprints) do we have?
- System.out.println("Total stored templates: " + fp.getNumTemplates());
-
- // now spin waiting for a fingerprint to successfully image
- System.out.println("Waiting for finger print...");
- while (fp.generateImage() == upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_NO_FINGER.swigValue());
-
- // in theory, we have an image
- System.out.println("Image captured, converting...");
- short rv = fp.image2Tz(1);
- if (rv != upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_OK.swigValue()) {
- System.err.println("Image conversion failed with error code " + rv);
- System.exit(-1);
- }
- System.out.println("Image conversion succeeded");
-
- // we search for a print matching slot 1, where we shored our last
- // converted fingerprint
- int[] id = new int[1];
- int[] score = new int[1];
- rv = fp.search(1, id, score);
- if (rv != upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_OK.swigValue()) {
- if (rv == upm_zfm20.ZFM20.ZFM20_ERRORS_T.ERR_FP_NOTFOUND.swigValue()) {
- System.out.println("Fingerprint not found");
- System.exit(0);
- } else {
- System.err.println("Search failed with error code " + rv);
- System.exit(-1);
- }
- }
-
- System.out.println("Fingerprint found!");
- System.out.println("ID: " + id[0] + ", Score: " + score[0]);
-
- // ! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/javascript/a110x.js b/peripheral/libupm/examples/javascript/a110x.js
deleted file mode 100644
index df26d37..0000000
--- a/peripheral/libupm/examples/javascript/a110x.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var hallEffectSensor = require('jsupm_a110x');
-
-// Instantiate a Hall Effect magnet sensor on digital pin D2
-var myHallEffectSensor = new hallEffectSensor.A110X(2);
-
-// Check every second for the presence of a magnetic field (south polarity)
-setInterval(function()
-{
- if (myHallEffectSensor.magnetDetected())
- console.log("Magnet (south polarity) detected.");
- else
- console.log("No magnet detected.");
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/ad8232.js b/peripheral/libupm/examples/javascript/ad8232.js
deleted file mode 100644
index 56913fa..0000000
--- a/peripheral/libupm/examples/javascript/ad8232.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Jon Trulson <jtrulson@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var ad8232Sensor_lib = require('jsupm_ad8232');
-
-// Instantiate a AD8232 sensor on digital pins 10 (LO+), 11 (LO-)
-// and an analog pin, 0 (OUTPUT)
-var myAd8232Sensor_obj = new ad8232Sensor_lib.AD8232(10, 11, 0);
-
-// Output the raw numbers from the ADC, for plotting elsewhere.
-// A return of 0 indicates a Lead Off (LO) condition.
-// In theory, this data could be fed to software like Processing
-// (https://www.processing.org/) to plot the data just like an
-// EKG you would see in a hospital.
-var myInterval = setInterval(function()
-{
- console.log(myAd8232Sensor_obj.value());
-}, 1);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myAd8232Sensor_obj = null;
- ad8232Sensor_lib.cleanUp();
- ad8232Sensor_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/adafruitms1438-stepper.js b/peripheral/libupm/examples/javascript/adafruitms1438-stepper.js
deleted file mode 100644
index d06edce..0000000
--- a/peripheral/libupm/examples/javascript/adafruitms1438-stepper.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-function exit()
-{
- console.log("Exiting");
-
- myMotorShield_obj = null;
- if (MotorShield_lib)
- {
- MotorShield_lib.cleanUp();
- MotorShield_lib = null;
- }
- process.exit(0);
-}
-
-var MotorShield_lib = require('jsupm_adafruitms1438');
-
-/* Import header values */
-var I2CBus = MotorShield_lib.ADAFRUITMS1438_I2C_BUS;
-var I2CAddr = MotorShield_lib.ADAFRUITMS1438_DEFAULT_I2C_ADDR;
-
-var M12motor = MotorShield_lib.AdafruitMS1438.STEPMOTOR_M12;
-var MotorDirCW = MotorShield_lib.AdafruitMS1438.DIR_CW;
-var MotorDirCCW = MotorShield_lib.AdafruitMS1438.DIR_CCW;
-
-
-// Instantiate an Adafruit MS 1438 on I2C bus 0
-var myMotorShield_obj = new MotorShield_lib.AdafruitMS1438(I2CBus, I2CAddr);
-
-
-// Setup for use with a stepper motor connected to the M1 & M2 ports
-
-// disable first, to be safe
-myMotorShield_obj.disableStepper(M12motor);
-
-// configure for a NEMA-17, 200 steps per revolution
-myMotorShield_obj.stepConfig(M12motor, 200);
-
-// set speed at 10 RPM's
-myMotorShield_obj.setStepperSpeed(M12motor, 10);
-myMotorShield_obj.setStepperDirection(M12motor, MotorDirCW);
-
-console.log("Enabling...");
-myMotorShield_obj.enableStepper(M12motor);
-
-console.log("Rotating 1 full revolution at 10 RPM speed.");
-myMotorShield_obj.stepperSteps(M12motor, 200);
-
-console.log("Sleeping for 2 seconds...");
-
-
-setTimeout(function()
-{
- console.log("Rotating 1/2 revolution in opposite direction at 10 RPM speed.");
-
- myMotorShield_obj.setStepperDirection(M12motor, MotorDirCCW);
- myMotorShield_obj.stepperSteps(M12motor, 100);
-
- console.log("Disabling...");
- myMotorShield_obj.disableStepper(M12motor);
- exit();
-}, 2000);
-
-
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/adafruitms1438.js b/peripheral/libupm/examples/javascript/adafruitms1438.js
deleted file mode 100644
index 7c34d1a..0000000
--- a/peripheral/libupm/examples/javascript/adafruitms1438.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-function exit()
-{
- console.log("Exiting");
-
- myMotorShield_obj = null;
- if (MotorShield_lib)
- {
- MotorShield_lib.cleanUp();
- MotorShield_lib = null;
- }
- process.exit(0);
-}
-
-var MotorShield_lib = require('jsupm_adafruitms1438');
-
-
-/* Import header values */
-var I2CBus = MotorShield_lib.ADAFRUITMS1438_I2C_BUS;
-var I2CAddr = MotorShield_lib.ADAFRUITMS1438_DEFAULT_I2C_ADDR;
-
-var M3motor = MotorShield_lib.AdafruitMS1438.MOTOR_M3;
-var MotorDirCW = MotorShield_lib.AdafruitMS1438.DIR_CW;
-var MotorDirCCW = MotorShield_lib.AdafruitMS1438.DIR_CCW;
-
-
-// Instantiate an Adafruit MS 1438 on I2C bus 0
-var myMotorShield_obj = new MotorShield_lib.AdafruitMS1438(I2CBus, I2CAddr);
-
-
-// Setup for use with a DC motor connected to the M3 port
-
-// set a PWM period of 50Hz
-myMotorShield_obj.setPWMPeriod(50);
-
-// disable first, to be safe
-myMotorShield_obj.disableMotor(M3motor);
-
-// set speed at 50%
-myMotorShield_obj.setMotorSpeed(M3motor, 50);
-myMotorShield_obj.setMotorDirection(M3motor, MotorDirCW);
-
-process.stdout.write("Spin M3 at half speed for 3 seconds, ");
-console.log("then reverse for 3 seconds.");
-myMotorShield_obj.enableMotor(M3motor);
-
-setTimeout(function()
-{
- console.log("Reversing M3");
- myMotorShield_obj.setMotorDirection(M3motor, MotorDirCCW);
-}, 3000);
-
-
-setTimeout(function()
-{
- console.log("Stopping M3");
- myMotorShield_obj.disableMotor(M3motor);
- exit();
-}, 6000);
-
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/adc121c021.js b/peripheral/libupm/examples/javascript/adc121c021.js
deleted file mode 100644
index b02de34..0000000
--- a/peripheral/libupm/examples/javascript/adc121c021.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load ADC121C021 module
-var I2C_ADC = require('jsupm_adc121c021');
-// Instantiate an ADC121C021 on I2C bus 0
-var busID = I2C_ADC.ADC121C021_I2C_BUS;
-var I2CAddr = I2C_ADC.ADC121C021_DEFAULT_I2C_ADDR;
-var myI2C_ADC = new I2C_ADC.ADC121C021(busID, I2CAddr);
-
-// get the data every 50 milliseconds
-var myInterval = setInterval(function()
-{
- var val = myI2C_ADC.value();
- var voltsVal = myI2C_ADC.valueToVolts(val);
- console.log("ADC value: " + val + " Volts = " + voltsVal);
-}, 50);
-
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myI2C_ADC = null;
- I2C_ADC.cleanUp();
- I2C_ADC = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/adis16448.js b/peripheral/libupm/examples/javascript/adis16448.js
deleted file mode 100644
index 1e83f82..0000000
--- a/peripheral/libupm/examples/javascript/adis16448.js
+++ /dev/null
@@ -1,67 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////////////
-// The MIT License (MIT)
-//
-// Submit Date: 03/09/2015
-// Author: Juan Jose Chong <juanjchong@gmail.com>
-// Copyright (c) 2015 Juan Jose Chong
-//
-//////////////////////////////////////////////////////////////////////////////////////
-// adis16448.js
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// This example code runs on an Intel Edison and uses mraa to acquire data
-// from an ADIS16448. This data is then scaled and printed onto the terminal.
-//
-// This software has been tested to connect to an ADIS16448 through a level shifter
-// such as the TI TXB0104. The SPI lines (DIN, DOUT, SCLK, /CS) are all wired through
-// the level shifter and the ADIS16448 is also being powered by the Intel Edison.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-//////////////////////////////////////////////////////////////////////////////////////
-
-//Call the ADIS16448 library
-var adis16448 = require('jsupm_adis16448');
-
-//Instantiate SPI and Reset
-var imu = new adis16448.ADIS16448(0,3);
-
-periodicActivity(); //Call the periodicActivity function
-
-function periodicActivity()
-{
- //Read & Scale Gyro/Accel Data
- var xgyro = imu.gyroScale(imu.regRead(0x04));
- var ygyro = imu.gyroScale(imu.regRead(0x06));
- var zgyro = imu.gyroScale(imu.regRead(0x08));
- var xaccl = imu.accelScale(imu.regRead(0x0A));
- var yaccl = imu.accelScale(imu.regRead(0x0C));
- var zaccl = imu.accelScale(imu.regRead(0x0E));
-
- //Display Scaled Data on the Console Log
- console.log('XGYRO: ' + xgyro);
- console.log('YGYRO: ' + ygyro);
- console.log('ZGYRO: ' + zgyro);
- console.log('XACCL: ' + xaccl);
- console.log('YACCL: ' + yaccl);
- console.log('ZACCL: ' + zaccl);
- console.log(' ');
- setTimeout(periodicActivity,200); //call the indicated function after 0.2 seconds (200 milliseconds)
-} \ No newline at end of file
diff --git a/peripheral/libupm/examples/javascript/ads1x15.js b/peripheral/libupm/examples/javascript/ads1x15.js
deleted file mode 100644
index 3556253..0000000
--- a/peripheral/libupm/examples/javascript/ads1x15.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-var mraa = require('mraa');
-var version = mraa.getVersion();
-
-if (version >= 'v0.6.1') {
- console.log('mraa version (' + version + ') ok');
-}
-else {
- console.log('mraa version(' + version + ') is old - this code may not work');
-}
-
-var ADS1X15 = require('jsupm_ads1x15');
-var ads1115 = new ADS1X15.ADS1115(1, 0x49);
-var ads1015 = new ADS1X15.ADS1015(1, 0x48);
-
-setInterval(function(){
- console.log(ads1115.getSample());
- console.log(ads1015.getSample());
- console.log("*********************");
-}, 1000);
-
-
diff --git a/peripheral/libupm/examples/javascript/adxl335.js b/peripheral/libupm/examples/javascript/adxl335.js
deleted file mode 100644
index 9ecf4fd..0000000
--- a/peripheral/libupm/examples/javascript/adxl335.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var analogGyro3Axis = require("jsupm_adxl335");
-
-var g_addnumBool = true;
-var g_cycleNum = 0.0;
-var g_cycleCount = 0;
-
-// Instantiate an ADXL335 accelerometer on analog pins A0, A1, and A2
-var myAnalogGyro3Axis = new analogGyro3Axis.ADXL335(0, 1, 2);
-
-console.log("Please make sure the sensor is completely still.");
-console.log("Sleeping for 2 seconds");
-
-var g_myInterval;
-
-setTimeout(function()
-{
- console.log("Calibrating...");
- myAnalogGyro3Axis.calibrate();
- // Get values from accelerometer every 0.2 seconds
- g_myInterval = setInterval(runAccelerometer, 200);
-}, 2000);
-
-
-var x = new analogGyro3Axis.new_intPointer();
-var y = new analogGyro3Axis.new_intPointer();
-var z = new analogGyro3Axis.new_intPointer();
-
-var aX = new analogGyro3Axis.new_floatPointer();
-var aY = new analogGyro3Axis.new_floatPointer();
-var aZ = new analogGyro3Axis.new_floatPointer();
-
-var outputStr;
-
-function runAccelerometer()
-{
- myAnalogGyro3Axis.values(x, y, z);
- outputStr = "Raw Values: X: " +
- analogGyro3Axis.intPointer_value(x) +
- " Y: " + analogGyro3Axis.intPointer_value(y) +
- " Z: " + analogGyro3Axis.intPointer_value(z);
- console.log(outputStr);
-
- myAnalogGyro3Axis.acceleration(aX, aY, aZ);
- outputStr = "Acceleration: X: " +
- analogGyro3Axis.floatPointer_value(aX) + "g\n" +
- "Acceleration: Y: " +
- analogGyro3Axis.floatPointer_value(aY) + "g\n" +
- "Acceleration: Z: " +
- analogGyro3Axis.floatPointer_value(aZ) + "g";
- console.log(outputStr);
-
- console.log(" ");
-}
-
-
-// When exiting: clear interval and print exit message
-process.on('SIGINT', function()
-{
- clearInterval(g_myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/adxl345.js b/peripheral/libupm/examples/javascript/adxl345.js
deleted file mode 100644
index d03d1f4..0000000
--- a/peripheral/libupm/examples/javascript/adxl345.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load accelerometer
-var adxl345 = require('jsupm_adxl345');
-
-// Instantiate on I2C bus
-var adxl = new adxl345.Adxl345(0);
-
-setInterval(function()
-{
- adxl.update(); // Update the data
- var raw = adxl.getRawValues(); // Read raw sensor data
- var force = adxl.getAcceleration(); // Read acceleration force (g)
- var rawvalues = raw.getitem(0) + " " + raw.getitem(1) + " " + raw.getitem(2);
- console.log("Raw Values: " + rawvalues);
- console.log("ForceX: " + force.getitem(0).toFixed(2) + " g");
- console.log("ForceY: " + force.getitem(1).toFixed(2) + " g");
- console.log("ForceZ: " + force.getitem(2).toFixed(2) + " g");
-}, 1000);
diff --git a/peripheral/libupm/examples/javascript/adxrs610.js b/peripheral/libupm/examples/javascript/adxrs610.js
deleted file mode 100644
index 16c105c..0000000
--- a/peripheral/libupm/examples/javascript/adxrs610.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_adxrs610');
-
-// Instantiate a ADXRS610 sensor on analog pin A0 (dataout), and
-// analog A1 (temp out) with an analog reference voltage of
-// 5.0
-var sensor = new sensorObj.ADXRS610(0, 1, 5.0);
-
-// set a deadband region around the zero point to report 0.0 (optional)
-sensor.setDeadband(0.015);
-
-// Every tenth of a second, sample the ADXRS610 and output it's
-// corresponding temperature and angular velocity
-
-setInterval(function()
-{
- console.log("Vel (deg/s): " + sensor.getAngularVelocity());
- console.log("Temp (C): " + sensor.getTemperature());
-}, 100);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/ak8975.js b/peripheral/libupm/examples/javascript/ak8975.js
deleted file mode 100644
index 6081719..0000000
--- a/peripheral/libupm/examples/javascript/ak8975.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_mpu9150');
-
-// Instantiate an AK8975 on default I2C bus and address
-var sensor = new sensorObj.AK8975();
-
-// Initialize the device with default values
-sensor.init();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getMagnetometer(x, y, z);
- console.log("Magnetometer: MX: " + sensorObj.floatp_value(x) +
- " MY: " + sensorObj.floatp_value(y) +
- " MZ: " + sensorObj.floatp_value(z));
-
- console.log();
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/apds9002.js b/peripheral/libupm/examples/javascript/apds9002.js
deleted file mode 100644
index 829584f..0000000
--- a/peripheral/libupm/examples/javascript/apds9002.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load Grove Luminance sensor module
-var luminanceSensor_lib = require('jsupm_apds9002');
-
-// Instantiate a Grove Luminance sensor on analog pin A0
-var myLuminanceSensor_obj = new luminanceSensor_lib.APDS9002(0);
-
-var myInterval = setInterval(function()
-{
- console.log("Luminance value is " + myLuminanceSensor_obj.value());
-}, 1000);
-
-// On exit: clear interval and memory, print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myLuminanceSensor_obj = null;
- luminanceSensor_lib.cleanUp();
- luminanceSensor_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/at42qt1070.js b/peripheral/libupm/examples/javascript/at42qt1070.js
deleted file mode 100644
index c061f13..0000000
--- a/peripheral/libupm/examples/javascript/at42qt1070.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/* functions */
-function printButtons(touchObj)
-{
- var buttonPressed = false;
- var buttons = touchObj.getButtons();
-
- process.stdout.write("Buttons Pressed: ");
- for (var i=0; i<7; i++)
- {
- if (buttons & (1 << i))
- {
- process.stdout.write(i + " ");
- buttonPressed = true;
- }
- }
-
- if (!buttonPressed)
- process.stdout.write("None");
-
- console.log(" ");
-
- if (touchObj.isCalibrating())
- console.log("Calibration is occurring.");
-
- if (touchObj.isOverflowed())
- console.log("Overflow was detected.");
-}
-
-
-/* Global code that runs on startup */
-
-var touchSensor_lib = require('jsupm_at42qt1070');
-
-var I2C_BUS = touchSensor_lib.AT42QT1070_I2C_BUS;
-var DEFAULT_I2C_ADDR = touchSensor_lib.AT42QT1070_DEFAULT_I2C_ADDR;
-// Instantiate an AT42QT1070 on I2C bus 0
-var mytouchSensor_obj = new touchSensor_lib.AT42QT1070(I2C_BUS,
- DEFAULT_I2C_ADDR);
-
-var myInterval = setInterval(function()
-{
- mytouchSensor_obj.updateState();
- printButtons(mytouchSensor_obj);
-}, 100);
-
-// Print message when exiting and clear interval/memory
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- mytouchSensor_obj = null;
- touchSensor_lib.cleanUp();
- touchSensor_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/biss0001.js b/peripheral/libupm/examples/javascript/biss0001.js
deleted file mode 100644
index 830a88d..0000000
--- a/peripheral/libupm/examples/javascript/biss0001.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load Grove Motion module
-var grove_motion = require('jsupm_biss0001');
-// Instantiate a Grove Motion sensor on GPIO pin D2
-var myMotionObj = new grove_motion.BISS0001(2);
-setInterval(function()
-{
- if (myMotionObj.value())
- console.log("Detecting moving object");
- else
- console.log("No moving objects detected");
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/bma220.js b/peripheral/libupm/examples/javascript/bma220.js
deleted file mode 100644
index bc267de..0000000
--- a/peripheral/libupm/examples/javascript/bma220.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_bma220');
-
-// Instantiate an BMA220 using default parameters (bus 0, addr 0x0a)
-var sensor = new sensorObj.BMA220();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getAccelerometer(x, y, z);
- console.log("Accelerometer: AX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/bmpx8x.js b/peripheral/libupm/examples/javascript/bmpx8x.js
deleted file mode 100644
index 3da0514..0000000
--- a/peripheral/libupm/examples/javascript/bmpx8x.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load Barometer module
-var bmpx8x = require('jsupm_bmpx8x');
-// load this on i2c
-var myBarometerObj = new bmpx8x.BMPX8X(0, bmpx8x.ADDR);
-var pressure, temperature, altitude, sealevel;
-
-// Print the pressure, altitude, sea level, and
-// temperature values every 0.1 seconds
-setInterval(function()
-{
- var pressure = myBarometerObj.getPressure();
- var temperature = myBarometerObj.getTemperature();
- var altitude = myBarometerObj.getAltitude();
- var sealevel = myBarometerObj.getSealevelPressure();
-
- var BMPX8Xresults = "pressure value = " + pressure;
- BMPX8Xresults += ", altitude value = " + altitude;
- BMPX8Xresults += ", sealevel value = " + sealevel;
- BMPX8Xresults += ", temperature = " + temperature;
- console.log(BMPX8Xresults);
-}, 100);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/buzzer.js b/peripheral/libupm/examples/javascript/buzzer.js
deleted file mode 100644
index 4fcc7dc..0000000
--- a/peripheral/libupm/examples/javascript/buzzer.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmBuzzer = require("jsupm_buzzer");
-// Initialize on GPIO 5
-var myBuzzer = new upmBuzzer.Buzzer(5);
-var chords = [];
-chords.push(upmBuzzer.DO);
-chords.push(upmBuzzer.RE);
-chords.push(upmBuzzer.MI);
-chords.push(upmBuzzer.FA);
-chords.push(upmBuzzer.SOL);
-chords.push(upmBuzzer.LA);
-chords.push(upmBuzzer.SI);
-chords.push(upmBuzzer.DO);
-chords.push(upmBuzzer.SI);
-var chordIndex = 0;
-
-// Print sensor name
-console.log(myBuzzer.name());
-
-function melody()
-{
- if (chords.length != 0)
- {
- //Play sound for one second
- console.log( myBuzzer.playSound(chords[chordIndex], 1000000) );
- chordIndex++;
- //Reset the sound to start from the beginning.
- if (chordIndex > chords.length - 1)
- chordIndex = 0;
- }
-}
-setInterval(melody, 100);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/cjq4435.js b/peripheral/libupm/examples/javascript/cjq4435.js
deleted file mode 100644
index dac41b8..0000000
--- a/peripheral/libupm/examples/javascript/cjq4435.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var MOSFETsensor = require("jsupm_cjq4435");
-
-var g_addnumBool = true;
-var g_cycleNum = 0.0;
-var g_cycleCount = 0;
-
-// Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3
-var myMOSFETsensor = new MOSFETsensor.CJQ4435(3);
-
-myMOSFETsensor.setPeriodMS(10);
-myMOSFETsensor.enable(true);
-
-// A note on timing:
-// In the C++ example, the system sleeps 11 times for 100 milliseconds
-// between each duty cycle. After reaching the last point of the cycle,
-// the system sleeps again for 1 second.
-// The sleeps are cumulative, so the system has slept for 2.1 seconds
-// sum total for each cycle.
-// setInterval and setTimeout make asynchronous function calls;
-// they aren't cumulative.
-// In order to approximate the behavior of the C++ example, we need
-// to call each iteration 2.1 seconds apart instead of 1 second apart.
-
-var myInterval = setInterval(function()
-{
- setDutyCycle();
-}, (1000 + (11*100)) );
-
-
-// We start with a duty cycle of 0.0 (off) and increment to 1.0 (on)
-// Then we take it back down,
-// starting with a duty cycle of 1.0 (on) and decrement to 0.0 (off)
-function setDutyCycle()
-{
- myMOSFETsensor.setDutyCycle(g_cycleNum);
- if (g_addnumBool)
- g_cycleNum += 0.1;
- else
- g_cycleNum -= 0.1;
- g_cycleCount++;
- if (g_cycleCount > 10)
- {
- g_addnumBool = !g_addnumBool;
- g_cycleCount = 0;
- }
- else
- setTimeout(setDutyCycle, 100);
-}
-
-
-// When exiting: clear interval and print exit message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myMOSFETsensor = null;
- MOSFETsensor.cleanUp();
- MOSFETsensor = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/dfrph.js b/peripheral/libupm/examples/javascript/dfrph.js
deleted file mode 100644
index f9f7f55..0000000
--- a/peripheral/libupm/examples/javascript/dfrph.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_dfrph');
-
-// Instantiate a DFRPH sensor on analog pin A0, with an analog
-// reference voltage of 5.0
-var sensor = new sensorObj.DFRPH(0, 5.0);
-
-
-// After calibration, set the offset (based on calibration with a pH
-// 7.0 buffer solution). See the UPM sensor documentation for
-// calibrations instructions.
-sensor.setOffset(0.065);
-
-// Every second, sample the pH and output it's corresponding
-// analog voltage.
-
-setInterval(function()
-{
- console.log("Detected volts: " + sensor.volts());
- console.log("pH value: " + sensor.pH());
-}, 1000);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/ds1307.js b/peripheral/libupm/examples/javascript/ds1307.js
deleted file mode 100644
index 9d11319..0000000
--- a/peripheral/libupm/examples/javascript/ds1307.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load RTC Clock module for Grove - RTC clock
-var ds1307 = require('jsupm_ds1307');
-// load this on i2c bus 0
-var myRTCClockObj = new ds1307.DS1307(0);
-
-// always do this first
-console.log("Loading the current time... ");
-
-var result = myRTCClockObj.loadTime();
-if (!result)
-{
- console.log("myRTCClockObj.loadTime() failed.");
- process.exit(1);
-}
-
-printTime(myRTCClockObj);
-
-// set the year as an example
-console.log("setting the year to 50");
-myRTCClockObj.year = 50;
-myRTCClockObj.setTime();
-
-// reload the time and print it
-myRTCClockObj.loadTime();
-printTime(myRTCClockObj);
-
-function printTime(RTCObj)
-{
- var timeStr = "The time is: " +
- RTCObj.month + "/" + RTCObj.dayOfMonth + "/" + RTCObj.year + " " +
- RTCObj.hours + ":" + RTCObj.minutes + ":" + RTCObj.seconds;
-
- if (RTCObj.amPmMode)
- timeStr += (RTCObj.pm ? " PM " : " AM ");
-
- console.log(timeStr);
-
- console.log("Clock is in " +
- (RTCObj.amPmMode ? "AM/PM mode" : "24hr mode"));
-}
-
diff --git a/peripheral/libupm/examples/javascript/eboled.js b/peripheral/libupm/examples/javascript/eboled.js
deleted file mode 100644
index bf999de..0000000
--- a/peripheral/libupm/examples/javascript/eboled.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Author: Tyler Gibson <tgibson@microsoft.com>
- * Copyright (c) 2015 Microsoft Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var lcdObj = require('jsupm_i2clcd');
-var oled = new lcdObj.EBOLED();
-
-var sample = 0;
-var samples = 13;
-
-function exit()
-{
- oled = null;
- lcdObj.cleanUp();
- lcdObj = null;
- process.exit(0);
-}
-
-setInterval( function()
-{
- if(sample>samples)
- {
- exit();
- }
- oled.clearScreenBuffer();
- runSample(sample++);
- oled.refresh();
-}, 1500);
-
-function runSample(sample)
-{
- switch(sample) {
- case 0:
- // x/y coords are 0 based, using 1 here for padding.
- oled.setCursor(1,1);
- // nowrap = 0, wrapping = 1
- oled.setTextWrap(1);
- oled.write("HELLO WORLD! Mixed with #123 and y's, g's and q's.");
- break;
- case 1:
- oled.setCursor(12, 1);
- //multiply text size, only integers
- oled.setTextSize(3);
- oled.write("BOO!");
- oled.setTextSize(1);
- break;
- case 2:
- oled.drawRectangleFilled(0,0,48,9);
- oled.setCursor(1,1);
- // 0=Black, 1=White, 2=Xor (Toggle)
- oled.setTextColor(2);
- oled.write("Cutout");
- break;
- case 3:
- var total = Math.random()*100;
- for(var stars=0; stars<total; stars++ )
- oled.drawPixel(Math.floor(Math.random()*63), Math.floor(Math.random()*47), 1);
- break;
- case 4:
- for(var burst=0; burst<12; burst++)
- oled.drawLine(31, 24, Math.floor(Math.random()*63), Math.floor(Math.random()*47), 1);
- break;
- case 5:
- var lastPeak = 24;
- for(var peak=0; peak < 64; peak++)
- {
- var thisPeak = Math.abs(lastPeak + Math.floor(Math.random()*(-6) + Math.random()*6));
- oled.drawLine(peak, thisPeak, peak, 47, 1);
- lastPeak = thisPeak;
- }
- break;
- case 6:
- for(var y=0; y<47; y++)
- {
- oled.drawLineHorizontal(0,y+1,63,2);
- oled.refresh();
- oled.drawLineHorizontal(0,y,63,2);
- }
- break;
- case 7:
- var eqbarHeights = [ Math.floor(Math.random()*32),
- Math.floor(Math.random()*32),
- Math.floor(Math.random()*32),
- Math.floor(Math.random()*32),
- Math.floor(Math.random()*32),
- Math.floor(Math.random()*32),
- Math.floor(Math.random()*32) ];
- var begin = Date.now();
- while(Date.now()-begin < 2000)
- {
- oled.clearScreenBuffer();
- for(var eqbar=0; eqbar<7; eqbar++)
- {
- oled.drawRectangleFilled(eqbar*9, 49 - eqbarHeights[eqbar], 8, eqbarHeights[eqbar], 1);
- eqbarHeights[eqbar] = eqbarHeights[eqbar] + Math.random()*(-2) + Math.random()*2;
- if(eqbarHeights[eqbar]<0)
- eqbarHeights[eqbar] = 1;
- }
- oled.refresh();
- }
- oled.clear();
- break;
- case 8:
- oled.drawRoundedRectangle(8, 8, 48, 16, 4, 1);
- oled.setCursor(12, 16);
- oled.write("Cancel");
- break;
- case 9:
- oled.drawTriangle(2, 2, 52, 7, 17, 37, 1);
- break;
- case 10:
- oled.drawTriangleFilled(2, 2, 52, 7, 17, 37, 1);
- break;
- case 11:
- oled.drawCircle(32, 24, 14, 1);
- break;
- case 12:
- oled.drawCircleFilled(32, 24, 14, 1);
- break;
- case 13:
- oled.fillScreen(1);
- break;
- }
-}
diff --git a/peripheral/libupm/examples/javascript/enc03r.js b/peripheral/libupm/examples/javascript/enc03r.js
deleted file mode 100644
index 15b6d80..0000000
--- a/peripheral/libupm/examples/javascript/enc03r.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load analog gyro module
-var analogGyro = require('jsupm_enc03r');
-// Instantiate a ENC03R on analog pin A0
-var myGyro = new analogGyro.ENC03R(0);
-
-var CALIBRATION_SAMPLES = 1000;
-
-console.log("Please place the sensor in a stable location,\n" +
- "and do not move it while calibration takes place.\n" +
- "This may take a couple of minutes.");
-
-myGyro.calibrate(CALIBRATION_SAMPLES);
-console.log("Calibration complete. Reference value: " +
- myGyro.calibrationValue());
-
-// Read the input and print both the raw value and the angular velocity,
-// waiting 0.1 seconds between readings
-setInterval(function()
-{
- var gyroVal = myGyro.value();
- var outputStr = "Raw value: " + gyroVal + ", " +
- "angular velocity: " +
- roundNum(myGyro.angularVelocity(gyroVal), 5) + " deg/s";
- console.log(outputStr);
-}, 100);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum) * (Math.pow(10, decimalPlaces))) /
- Math.pow(10, decimalPlaces));
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/es08a.js b/peripheral/libupm/examples/javascript/es08a.js
deleted file mode 100644
index 36db8d2..0000000
--- a/peripheral/libupm/examples/javascript/es08a.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//Load servo module.
-var servoModule = require("jsupm_servo");
-
-//Instantiate ES08A Servo module on GPIO 5
-var servo = new servoModule.ES08A(5);
-
-// function to initialize servo
- // timeOffset: how long after hitting "run"
- // should we start this servo instance
- // timeInterval: how frequently should this instance run after timeOffset
- // angle: the angle for this instance
-function startServo(timeOffset, timeInterval, angle)
-{
- // Start running this instance after timeOffset milliseconds
- setTimeout(function()
- {
- // run this instance every timeInterval milliseconds
- setInterval(function()
- {
- servo.setAngle(angle);
- console.log("Set angle to " + angle);
- }, timeInterval);
- }, timeOffset);
- // timeOffset tells setTimeout when
- // to execute the function specified in the first param
- // angle is passed as a param to the specified function
-}
-// start immediately, run every 3 seconds, go 0 degrees
-startServo(0, 3000, 0);
-
-// start in 1 second, run every 3 seconds, go 90 degrees
-startServo(1000, 3000, 90);
-
-// start in 2 seconds, run every 3 seconds, go 180 degrees
-startServo(2000, 3000, 180);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/flex.js b/peripheral/libupm/examples/javascript/flex.js
deleted file mode 100644
index 73c6ee0..0000000
--- a/peripheral/libupm/examples/javascript/flex.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var flexSensor_lib = require('jsupm_flex');
-
-// The was tested with a Spectra Symbol flex sensor.
-// We attached a 22K resistor to a breadboard,
-// with 1 end attached to GND and the other connected to
-// both the flex sensor and A0.
-// The flex sensor was connected on 1 pin to the 22K resistor and A0
-// and on the other pin to 5V.
-
-// Instantiate a UV sensor on analog pin A0
-var myFlexSensor_obj = new flexSensor_lib.Flex(0);
-
-var myInterval = setInterval(function()
-{
- var outputStr = "Flex value: " + myFlexSensor_obj.value();
- console.log(outputStr);
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myFlexSensor_obj = null;
- flexSensor_lib.cleanUp();
- flexSensor_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/gp2y0a.js b/peripheral/libupm/examples/javascript/gp2y0a.js
deleted file mode 100644
index 3c0bc7b..0000000
--- a/peripheral/libupm/examples/javascript/gp2y0a.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-// JavaScript file for GP2Y0A family of IR Proximity Sensors
-
-// analog voltage, usually 3.3 or 5.0
-var GP2Y0A_AREF = 5.0;
-var SAMPLES_PER_QUERY = 20;
-
-var IRProximity = require('jsupm_gp2y0a');
-
-// Note, for the Grove 80cm version of this sensor, due to the way it is wired,
-// you need to plug this into the A0 port, where it will use the available
-// A1 pin for data.
-// Instantiate a GP2Y0A on analog pin A1
-var myVolts = new IRProximity.GP2Y0A(1);
-
-// The higher the voltage (closer to AREF) the closer the object is.
-// NOTE: The measured voltage will probably not exceed 3.3 volts.
-// Every second, print the averaged voltage value
-// (averaged over 20 samples).
-var myInterval = setInterval(function()
-{
- console.log("AREF: " + GP2Y0A_AREF +
- ", Voltage value (higher means closer): " +
- myVolts.value(GP2Y0A_AREF, SAMPLES_PER_QUERY));
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myVolts = null;
- IRProximity.cleanUp();
- IRProximity = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grove_mcfled.js b/peripheral/libupm/examples/javascript/grove_mcfled.js
deleted file mode 100644
index f539269..0000000
--- a/peripheral/libupm/examples/javascript/grove_mcfled.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmled = require("jsupm_grove");
-// Initialize on GPIO 2
-var myled = new upmled.GroveLed(2);
-myled.on();
-
-// Dummy setInterval, just to keep program from quitting
-// This way, the LED turns off when you quit the program
-var myInterval = setInterval(function()
-{
- ;
-}, 1000);
-
-// When exiting: turn off LED, clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myled.off();
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovebutton.js b/peripheral/libupm/examples/javascript/grovebutton.js
deleted file mode 100644
index 428396a..0000000
--- a/peripheral/libupm/examples/javascript/grovebutton.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var groveSensor = require('jsupm_grove');
-
-// Create the button object using GPIO pin 0
-var button = new groveSensor.GroveButton(0);
-
-// Read the input and print, waiting one second between readings
-function readButtonValue() {
- console.log(button.name() + " value is " + button.value());
-}
-setInterval(readButtonValue, 1000);
diff --git a/peripheral/libupm/examples/javascript/grovecircularled.js b/peripheral/libupm/examples/javascript/grovecircularled.js
deleted file mode 100644
index 3bc303c..0000000
--- a/peripheral/libupm/examples/javascript/grovecircularled.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Jun Kato
- * Contributions: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Instantiate a Grove Circular LED on gpio pins 9 and 8
-var GCL = require("jsupm_my9221");
-var circle = new GCL.GroveCircularLED(9, 8);
-var level = 0;
-
-// Show a spinner.
-var myInterval = setInterval(function()
-{
- circle.setSpinner(level);
- level = (level + 1) % 24;
-}, 100);
-
-// When exiting, clear interval and print message.
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- circle.setLevel(0);
- circle = null;
- GCL.cleanUp();
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovecollision.js b/peripheral/libupm/examples/javascript/grovecollision.js
deleted file mode 100644
index dc577a4..0000000
--- a/peripheral/libupm/examples/javascript/grovecollision.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var collision_lib = require("jsupm_grovecollision");
-
-// The was tested with the Grove Collision Sensor
-// Instantiate a Grove Collision on digital pin D2
-var collision_obj = new collision_lib.GroveCollision(2);
-
-var collisionState = false;
-console.log("No collision");
-
-// Having an infinate loop prevents nodeJS from catching Cntl-C
-// We need to catch Cntl-C to clean up memory
-// Instead, we check the collision sensor every millisecond
-var myInterval = setInterval(function()
-{
- if (collision_obj.isColliding() && !collisionState)
- {
- console.log("Collision!");
- collisionState = true;
- }
- else if (!collision_obj.isColliding() && collisionState)
- {
- console.log("No collision");
- collisionState = false;
- }
-}, 1);
-
-// When exiting: clear interval, clean up memory, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- collision_obj = null;
- collision_lib.cleanUp();
- collision_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveehr.js b/peripheral/libupm/examples/javascript/groveehr.js
deleted file mode 100644
index 7a9902b..0000000
--- a/peripheral/libupm/examples/javascript/groveehr.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load heart rate sensor module
-var heartRateSensor = require('jsupm_groveehr');
-// Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2
-var myHeartRateSensor = new heartRateSensor.GroveEHR(2);
-
-// set the beat counter to 0, init the clock and start counting beats
-myHeartRateSensor.clearBeatCounter();
-myHeartRateSensor.initClock();
-myHeartRateSensor.startBeatCounter();
-
-var millis, beats, hr;
-var myInterval = setInterval(function()
-{
- // we grab these just for display purposes in this example
- millis = myHeartRateSensor.getMillis();
- beats = myHeartRateSensor.beatCounter();
-
- // heartRate() requires that at least 5 seconds pass before
- // returning anything other than 0
- hr = myHeartRateSensor.heartRate();
-
- // output milliseconds passed, beat count, and computed heart rate
- console.log("Millis: " + millis + " Beats: " + beats +
- " Heart Rate: " + hr);
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myHeartRateSensor.stopBeatCounter();
- myHeartRateSensor = null
- heartRateSensor.cleanUp();
- heartRateSensor = null;
-
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveeldriver.js b/peripheral/libupm/examples/javascript/groveeldriver.js
deleted file mode 100644
index 362fb76..0000000
--- a/peripheral/libupm/examples/javascript/groveeldriver.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var eldriver_lib = require("jsupm_groveeldriver");
-
-// The was tested with the Grove El Driver Module
-// Instantiate a Grove El Driver on digital pin D2
-var eldriver_obj = new eldriver_lib.GroveElDriver(2);
-
-var lightState = true;
-
-var myInterval = setInterval(function()
-{
- if (lightState)
- eldriver_obj.on();
- else
- eldriver_obj.off();
- lightState = !lightState;
-}, 1000);
-
-// When exiting: turn off EL wire, clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- eldriver_obj.off();
- eldriver_obj = null;
- eldriver_lib.cleanUp();
- eldriver_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveelectromagnet.js b/peripheral/libupm/examples/javascript/groveelectromagnet.js
deleted file mode 100644
index 390fa85..0000000
--- a/peripheral/libupm/examples/javascript/groveelectromagnet.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var electromagnet_lib = require("jsupm_groveelectromagnet");
-// The was tested with the Grove Electromagnetic Module
-// Instantiate a Grove Electromagnet on digital pin D2
-var electromagnet_obj = new electromagnet_lib.GroveElectromagnet(2);
-console.log("Starting up magnet....");
-electromagnet_obj.off();
-
-var magnetState = false;
-
-// Turn magnet on and off every 5 seconds
-var myInterval = setInterval(function()
-{
- magnetState = !magnetState;
- if (magnetState)
- electromagnet_obj.on();
- else
- electromagnet_obj.off();
- console.log("Turning magnet " + ((magnetState) ? "on" : "off"));
-}, 5000);
-
-// When exiting: clear interval, turn off magnet, run memory cleanup, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- electromagnet_obj.off();
- electromagnet_obj = null;
- electromagnet_lib.cleanUp();
- electromagnet_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveemg.js b/peripheral/libupm/examples/javascript/groveemg.js
deleted file mode 100644
index 8eee4de..0000000
--- a/peripheral/libupm/examples/javascript/groveemg.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var groveemg_lib = require("jsupm_groveemg");
-
-// The was tested with the GroveEMG Muscle Signal Reader Sensor Module
-// Instantiate a GroveEMG on analog pin A0
-var groveemg_obj = new groveemg_lib.GroveEMG(0);
-console.log("Calibrating....");
-groveemg_obj.calibrate();
-
-var myInterval = setInterval(function()
-{
- console.log(groveemg_obj.value());
-}, 100);
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- groveemg_obj = null;
- groveemg_lib.cleanUp();
- groveemg_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovegprs.js b/peripheral/libupm/examples/javascript/grovegprs.js
deleted file mode 100644
index d63f088..0000000
--- a/peripheral/libupm/examples/javascript/grovegprs.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_grovegprs');
-
-
-/************** Functions **************/
-function printUsage(progname)
-{
- var outputStr = "Usage: " + progname + " [AT command]\n\n" +
- "If an argument is supplied on the command line, that argument is\n" +
- "sent to the module and the response is printed out.\n\n" +
- "If no argument is used, then the manufacturer and the current\n" +
- "saved profiles are queried and the results printed out.\n\n"
- console.log(outputStr);
-}
-
-// simple helper function to send a command and wait for a response
-function sendCommand(sensor, cmd, callback)
-{
- // commands need to be terminated with a carriage return
- cmd += "\r";
- sensor.writeDataStr(cmd);
-
- // wait up to 1 second
- if (sensor.dataAvailable(1000))
- {
- console.log("Returned: " + sensor.readDataStr(1024));
- }
- else
- console.log("Timed out waiting for response");
-
- if (callback)
- callback();
-}
-
-/************** Main code **************/
-// Instantiate a GROVEGPRS Module on UART 0
-var sensor = new sensorObj.GroveGPRS(0);
-
-// Set the baud rate, 19200 baud is the default.
-if (sensor.setBaudRate(19200))
-{
- console.log("Failed to set baud rate");
- process.exit(0);
-}
-
-printUsage(process.argv[1]);
-
-// Note: in nodeJS, command-line argument 0 is "node".
-// Command-line argument 1 is "grovegprs.js"
-// If you have a third argument, then it's a command
-if (process.argv.length > 2)
-{
- console.log("Sending command line argument (" + process.argv[2] + ")...");
- sendCommand(sensor, process.argv[2]);
-}
-else
-{
- // sending this command as a synchronous callback ensures better timing
- var callbackFunc = function()
- {
- setTimeout(function()
- {
- // query the saved profiles
- console.log("Querying the saved profiles (AT&V)...");
- sendCommand(sensor, "AT&V");
-
- // A comprehensive list is available from the
- // datasheet at:
- // http://www.seeedstudio.com/wiki/images/7/72/AT_Commands_v1.11.pdf
- }, 1000);
- };
-
- // query the module manufacturer
- console.log("Querying module manufacturer (AT+CGMI)...");
- sendCommand(sensor, "AT+CGMI", callbackFunc);
-}
-
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovegsr.js b/peripheral/libupm/examples/javascript/grovegsr.js
deleted file mode 100644
index 5217eee..0000000
--- a/peripheral/libupm/examples/javascript/grovegsr.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var grovegsr_lib = require("jsupm_grovegsr");
-
-// The was tested with the GroveGSR Galvanic Skin Response Sensor module.
-
-// Instantiate a GroveGSR on analog pin A0
-var grovegsr_obj = new grovegsr_lib.GroveGSR(0);
-console.log("Calibrating....");
-grovegsr_obj.calibrate();
-
-var myInterval = setInterval(function()
-{
- console.log(grovegsr_obj.value());
-}, 500);
-
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- grovegsr_obj = null;
- grovegsr_lib.cleanUp();
- grovegsr_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveled.js b/peripheral/libupm/examples/javascript/groveled.js
deleted file mode 100644
index 7314d39..0000000
--- a/peripheral/libupm/examples/javascript/groveled.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var groveSensor = require('jsupm_grove');
-
-// Create the Grove LED object using GPIO pin 2
-var led = new groveSensor.GroveLed(2);
-
-// Print the name
-console.log(led.name());
-
-// Turn the LED on and off 10 times, pausing one second
-// between transitions
-var i = 0;
-var waiting = setInterval(function() {
- if ( i % 2 == 0 ) {
- led.on();
- } else {
- led.off();
- }
- i++;
- if ( i == 20 ) clearInterval(waiting);
- }, 1000);
-
diff --git a/peripheral/libupm/examples/javascript/groveledbar.js b/peripheral/libupm/examples/javascript/groveledbar.js
deleted file mode 100644
index 960463f..0000000
--- a/peripheral/libupm/examples/javascript/groveledbar.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var LEDBar = require("jsupm_my9221");
-
-// Instantiate a MY9221, we use D8 for the data, and D9 for the
-// data clock. This was tested with a Grove LED bar.
-var myLEDBar = new LEDBar.GroveLEDBar(8, 9);
-
-var directionBool = true;
-
-// A note on timing:
-// In the C++ example, the system sleeps 10 times for 50 milliseconds
-// between each LED lighting. After the LED has reached the last light
-// of the cycle, the system sleeps again for 1 second.
-// The sleeps are cumulative, so the system has slept for 1.5 seconds
-// sum total for each cycle.
-// setInterval and setTimeout make asynchronous function calls;
-// they aren't cumulative.
-// In order to approximate the behavior of the C++ example, we need
-// to call each iteration 1.5 seconds apart instead of 1 second apart.
-var myInterval = setInterval(function()
-{
- // start showing LED strip with just the first one lit
- show_LED(1, directionBool);
-}, (1000 + (10*50)) );
-
-function show_LED(level, direction)
-{
- // If it's less than 10
- // light up the LED now
- // call show_LED again in 50 ms
- if (level <= 10)
- {
- myLEDBar.setBarLevel(level, directionBool);
- setTimeout(show_LED, 50, ++level, directionBool);
- }
- // Switch LED lighting directions between lighting cycles
- else
- directionBool = !directionBool;
-}
-
-// When exiting: clear LED strip lights, clear interval, print exit message
-process.on('SIGINT', function()
-{
- myLEDBar.setBarLevel(0, true);
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovelight.js b/peripheral/libupm/examples/javascript/grovelight.js
deleted file mode 100644
index d09b462..0000000
--- a/peripheral/libupm/examples/javascript/grovelight.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var groveSensor = require('jsupm_grove');
-
-// Create the light sensor object using AIO pin 0
-var light = new groveSensor.GroveLight(0);
-
-// Read the input and print both the raw value and a rough lux value,
-// waiting one second between readings
-function readLightSensorValue() {
- console.log(light.name() + " raw value is " + light.raw_value() +
- ", which is roughly " + light.value() + " lux");
-}
-setInterval(readLightSensorValue, 1000);
diff --git a/peripheral/libupm/examples/javascript/grovelinefinder.js b/peripheral/libupm/examples/javascript/grovelinefinder.js
deleted file mode 100644
index 85f0b96..0000000
--- a/peripheral/libupm/examples/javascript/grovelinefinder.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var lineFinderSensor = require('jsupm_grovelinefinder');
-
-// Instantiate a Grove line finder sensor on digital pin D2
-var myLineFinderSensor = new lineFinderSensor.GroveLineFinder(2);
-
-// Check every second for the presence of white detection
-setInterval(function()
-{
- if (myLineFinderSensor.whiteDetected())
- console.log("White detected.");
- else
- console.log("Black detected.");
-}, 1000);
-
-// Turn relay off when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovemd-stepper.js b/peripheral/libupm/examples/javascript/grovemd-stepper.js
deleted file mode 100644
index 1264d8a..0000000
--- a/peripheral/libupm/examples/javascript/grovemd-stepper.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var grovemdObj = require('jsupm_grovemd');
-
-// This example demonstrates using the GroveMD to drive a stepper motor
-
-function start()
-{
- if (motor)
- {
- // configure it, for this example, we'll assume 200 steps per rev
- motor.configStepper(200);
- motor.setStepperSteps(100);
- // start it going at 10 RPM
- motor.enableStepper(grovemdObj.GroveMD.STEP_DIR_CW, 10);
- }
-}
-
-function reverse()
-{
- if (motor)
- {
- // now reverse
- motor.setStepperSteps(100);
- // start it going at 10 RPM
- motor.enableStepper(grovemdObj.GroveMD.STEP_DIR_CCW, 10);
- }
-}
-
-function end()
-{
- if (motor)
- {
- motor.disableStepper();
- }
- exit();
-}
-
-// When exiting: clear memory and print exit message
-function exit()
-{
- if (motor)
- {
- motor = null;
- grovemdObj.cleanUp();
- }
- grovemdObj = null;
- console.log("Exiting");
- process.exit(0);
-}
-
-
-// Instantiate an I2C Grove Motor Driver on I2C bus 0
-var motor = new grovemdObj.GroveMD(
- grovemdObj.GROVEMD_I2C_BUS,
- grovemdObj.GROVEMD_DEFAULT_I2C_ADDR);
-
-start();
-
-setTimeout(function()
-{
- reverse();
- setTimeout(end, 3000);
-}, 3000);
-
-
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/grovemd.js b/peripheral/libupm/examples/javascript/grovemd.js
deleted file mode 100644
index 76109f4..0000000
--- a/peripheral/libupm/examples/javascript/grovemd.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var groveMotorDriver_lib = require('jsupm_grovemd');
-
-function start()
-{
- if (my_MotorDriver_obj)
- {
- // set direction to CW and set speed to 50%
- console.log("Spin M1 and M2 at half speed for 3 seconds");
- my_MotorDriver_obj.setMotorDirections(groveMotorDriver_lib.GroveMD.DIR_CW,
- groveMotorDriver_lib.GroveMD.DIR_CW);
- my_MotorDriver_obj.setMotorSpeeds(127, 127);
- }
-}
-
-function reverse()
-{
- if (my_MotorDriver_obj)
- {
- // counter clockwise
- console.log("Reversing M1 and M2 for 3 seconds");
- my_MotorDriver_obj.setMotorDirections(groveMotorDriver_lib.GroveMD.DIR_CCW,
- groveMotorDriver_lib.GroveMD.DIR_CCW);
- }
-}
-
-function end()
-{
- if (my_MotorDriver_obj)
- {
- console.log("Stopping motors");
- my_MotorDriver_obj.setMotorSpeeds(0, 0);
- }
- exit();
-}
-
-// When exiting: clear memory and print exit message
-function exit()
-{
- if (my_MotorDriver_obj)
- {
- my_MotorDriver_obj = null;
- groveMotorDriver_lib.cleanUp();
- }
- groveMotorDriver_lib = null;
- console.log("Exiting");
- process.exit(0);
-}
-
-
-// Instantiate an I2C Grove Motor Driver on I2C bus 0
-var my_MotorDriver_obj = new groveMotorDriver_lib.GroveMD(
- groveMotorDriver_lib.GROVEMD_I2C_BUS,
- groveMotorDriver_lib.GROVEMD_DEFAULT_I2C_ADDR);
-
-start();
-
-setTimeout(function()
-{
- reverse();
- setTimeout(end, 3000);
-}, 3000);
-
-
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/grovemoisture.js b/peripheral/libupm/examples/javascript/grovemoisture.js
deleted file mode 100644
index 3d3f705..0000000
--- a/peripheral/libupm/examples/javascript/grovemoisture.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load Grove Moisture module
-var grove_moisture = require('jsupm_grovemoisture');
-
-// Instantiate a Grove Moisture sensor on analog pin A0
-var myMoistureObj = new grove_moisture.GroveMoisture(0);
-
-// Values (approximate):
-// 0-300, sensor in air or dry soil
-// 300-600, sensor in humid soil
-// 600+, sensor in wet soil or submerged in water
-// Read the value every second and print the corresponding moisture level
-setInterval(function()
-{
- var result;
- var moisture_val = parseInt(myMoistureObj.value());
- if (moisture_val >= 0 && moisture_val < 300)
- result = "Dry";
- else if (moisture_val >= 300 && moisture_val < 600)
- result = "Moist";
- else
- result = "Wet";
- console.log("Moisture value: " + moisture_val + ", " + result);
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groveo2.js b/peripheral/libupm/examples/javascript/groveo2.js
deleted file mode 100644
index 14ac46f..0000000
--- a/peripheral/libupm/examples/javascript/groveo2.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var groveO2_lib = require("jsupm_groveo2");
-
-// The was tested with the O2 Oxygen Concentration Sensor Module
-// Instantiate a GroveO2 on analog pin A0
-var groveO2_obj = new groveO2_lib.GroveO2(0);
-
-var myInterval = setInterval(function()
-{
- console.log("The output voltage is: " + roundNum(groveO2_obj.voltageValue(), 5) + "mV");
-}, 100);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum) * (Math.pow(10, decimalPlaces))) / Math.pow(10, decimalPlaces));
-}
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- groveO2_obj = null;
- groveO2_lib.cleanUp();
- groveO2_lib = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/groverelay.js b/peripheral/libupm/examples/javascript/groverelay.js
deleted file mode 100644
index a8fefe7..0000000
--- a/peripheral/libupm/examples/javascript/groverelay.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var groveSensor = require('jsupm_grove');
-
-// Create the relay switch object using GPIO pin 0
-var relay = new groveSensor.GroveRelay(0);
-
-// Close and then open the relay switch 3 times,
-// waiting one second each time. The LED on the relay switch
-// will light up when the switch is on (closed).
-// The switch will also make a noise between transitions.
-var i = 0;
-var waiting = setInterval(function() {
- if ( i % 2 == 0 ) {
- relay.on();
- if ( relay.isOn() )
- console.log(relay.name() + " is on");
- } else {
- relay.off();
- if ( relay.isOff() )
- console.log(relay.name() + " is off");
- }
- i++;
- if ( i == 6) clearInterval(waiting);
- }, 1000);
-
diff --git a/peripheral/libupm/examples/javascript/groverotary.js b/peripheral/libupm/examples/javascript/groverotary.js
deleted file mode 100644
index 040f38c..0000000
--- a/peripheral/libupm/examples/javascript/groverotary.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//setup/Initialization
-var upm_grove = require('jsupm_grove');
-
-//setup access analog input Analog pin #0 (A0)
-var groveRotary = new upm_grove.GroveRotary(0);
-
-loop();
-
-function loop()
-{
- var abs = groveRotary.abs_value();
- var absdeg = groveRotary.abs_deg();
- var absrad = groveRotary.abs_rad();
-
- var rel = groveRotary.rel_value();
- var reldeg = groveRotary.rel_deg();
- var relrad = groveRotary.rel_rad();
-
- //write the knob value to the console in different formats
- console.log("Abs: " + abs + " " + Math.round(parseInt(absdeg)) + " " + absrad.toFixed(3));
- console.log("Rel: " + rel + " " + Math.round(parseInt(reldeg)) + " " + relrad.toFixed(3));
-
- //wait 2 s and call function again
- setTimeout(loop, 2000);
-}
diff --git a/peripheral/libupm/examples/javascript/grovescam.js b/peripheral/libupm/examples/javascript/grovescam.js
deleted file mode 100644
index 7872bf8..0000000
--- a/peripheral/libupm/examples/javascript/grovescam.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var cameraObj = require('jsupm_grovescam');
-
-// Instantiate a Grove Serial Camera on UART 0
-var camera = new cameraObj.GROVESCAM(0);
-
-// make sure port is initialized properly. 115200 baud is the default.
-if (!camera.setupTty())
-{
- console.log("Failed to setup tty port parameters");
- process.exit(1);
-}
-
-if (camera.init())
- console.log("Initialized...");
-else
- console.log("init() failed");
-
-if (camera.preCapture())
- console.log("preCapture succeeded...");
-else
- console.log("preCapture failed.");
-
-if (camera.doCapture())
- console.log("doCapture succeeded...");
-else
- console.log("doCapture failed.");
-
-console.log("Image size is " + camera.getImageSize() + " bytes");
-
-if (camera.getImageSize() > 0)
-{
- console.log("Storing image.jpg...");
- if (camera.storeImage("image.jpg"))
- console.log("storeImage succeeded...");
- else
- console.log("storeImage failed.");
-}
-
-
-camera = null;
-cameraObj.cleanUp();
-cameraObj = null;
-console.log("Exiting.");
-process.exit(0);
-
diff --git a/peripheral/libupm/examples/javascript/groveslide.js b/peripheral/libupm/examples/javascript/groveslide.js
deleted file mode 100644
index bd16eee..0000000
--- a/peripheral/libupm/examples/javascript/groveslide.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upm_grove = require('jsupm_grove');
-
-//setup access analog input Analog pin #0 (A0)
-var groveSlide = new upm_grove.GroveSlide(0);
-
-loop();
-
-function loop()
-{
- var raw = groveSlide.raw_value();
- var volts = groveSlide.voltage_value();
-
- //write the slider values to the console
- console.log("Slider Value: " + raw + " = " + volts.toFixed(2) + " V");
-
- //wait 2 s then call function again
- setTimeout(loop, 2000);
-}
diff --git a/peripheral/libupm/examples/javascript/grovespeaker.js b/peripheral/libupm/examples/javascript/grovespeaker.js
deleted file mode 100644
index bac28f0..0000000
--- a/peripheral/libupm/examples/javascript/grovespeaker.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load Grove Speaker module
-var groveSpeaker = require('jsupm_grovespeaker');
-// Instantiate a Grove Speaker on digital pin D2
-var mySpeaker = new groveSpeaker.GroveSpeaker(2);
-
-// Play all 7 of the lowest notes
-mySpeaker.playAll();
-
-// Play a medium C-sharp
-mySpeaker.playSound('c', true, "med");
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovetemp.js b/peripheral/libupm/examples/javascript/grovetemp.js
deleted file mode 100644
index dba3954..0000000
--- a/peripheral/libupm/examples/javascript/grovetemp.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var groveSensor = require('jsupm_grove');
-
-// Create the temperature sensor object using AIO pin 0
-var temp = new groveSensor.GroveTemp(0);
-console.log(temp.name());
-
-// Read the temperature ten times, printing both the Celsius and
-// equivalent Fahrenheit temperature, waiting one second between readings
-var i = 0;
-var waiting = setInterval(function() {
- var celsius = temp.value();
- var fahrenheit = celsius * 9.0/5.0 + 32.0;
- console.log(celsius + " degrees Celsius, or " +
- Math.round(fahrenheit) + " degrees Fahrenheit");
- i++;
- if (i == 10) clearInterval(waiting);
- }, 1000);
diff --git a/peripheral/libupm/examples/javascript/groveultrasonic.js b/peripheral/libupm/examples/javascript/groveultrasonic.js
deleted file mode 100644
index e2b5804..0000000
--- a/peripheral/libupm/examples/javascript/groveultrasonic.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Author: Jun Kato <i@junkato.jp>
- * Copyright (c) 2015 Jun Kato.
- *
- * Thanks to Seeed Studio for a working arduino sketch
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var ultrasonic = require("jsupm_groveultrasonic");
-var sensor = new ultrasonic.GroveUltraSonic(2);
-
-var myInterval = setInterval(function()
-{
- var travelTime = sensor.getDistance();
- if (travelTime > 0) {
- var distance = (travelTime / 29 / 2).toFixed(3);
- console.log("distance: " + distance + " [cm]");
- }
-}, 200);
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovevdiv.js b/peripheral/libupm/examples/javascript/grovevdiv.js
deleted file mode 100644
index 4ff052a..0000000
--- a/peripheral/libupm/examples/javascript/grovevdiv.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var voltageDivider = require('jsupm_grovevdiv');
-// Instantiate a Grove Voltage Divider sensor on analog pin A0
-var myVoltageDivider = new voltageDivider.GroveVDiv(0);
-
-// collect data and output measured voltage according to the setting
-// of the scaling switch (3 or 10)
-var val, gain3val, gain10val;
-function getVoltageInfo()
-{
- val = myVoltageDivider.value(100);
- gain3val = myVoltageDivider.computedValue(3, val);
- gain10val = myVoltageDivider.computedValue(10, val);
- console.log("ADC value: " + val + " Gain 3: " + gain3val
- + "v Gain 10: " + gain10val + "v");
-}
-
-setInterval(getVoltageInfo, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- myVoltageDivider = null;
- voltageDivider.cleanUp();
- voltageDivider = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovewater.js b/peripheral/libupm/examples/javascript/grovewater.js
deleted file mode 100644
index 5768c9a..0000000
--- a/peripheral/libupm/examples/javascript/grovewater.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var waterSensor = require('jsupm_grovewater');
-
-// Instantiate a Grove Water sensor on digital pin D2
-var water = new waterSensor.GroveWater(2);
-
-// Read whether the sensor is wet/dry, waiting one second between readings
-function readWaterState()
-{
- if (water.isWet())
- console.log("Sensor is wet");
- else
- console.log("Sensor is dry");
-}
-setInterval(readWaterState, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/grovewfs.js b/peripheral/libupm/examples/javascript/grovewfs.js
deleted file mode 100644
index daa232c..0000000
--- a/peripheral/libupm/examples/javascript/grovewfs.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var waterFlow_lib = require('jsupm_grovewfs');
-
-// Instantiate a Grove Water Flow Sensor on digital pin D2
-var myWaterFlow_obj = new waterFlow_lib.GroveWFS(2);
-
-// set the flow counter to 0 and start counting
-myWaterFlow_obj.clearFlowCounter();
-myWaterFlow_obj.startFlowCounter();
-
-
-var millis, flowCount, fr;
-var myInterval = setInterval(function()
-{
- // we grab these (millis and flowCount) just for display
- // purposes in this example
- millis = myWaterFlow_obj.getMillis();
- flowCount = myWaterFlow_obj.flowCounter();
-
- fr = myWaterFlow_obj.flowRate();
-
- // output milliseconds passed, flow count, and computed flow rate
- outputStr = "Millis: " + millis + " Flow Count: " + flowCount +
- " Flow Rate: " + fr + " LPM";
- console.log(outputStr);
-
- // best to gather data for at least one second for reasonable
- // results.
-}, 2000);
-
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myWaterFlow_obj.stopFlowCounter();
- myWaterFlow_obj = null
- waterFlow_lib.cleanUp();
- waterFlow_lib = null;
-
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/guvas12d.js b/peripheral/libupm/examples/javascript/guvas12d.js
deleted file mode 100644
index 5410777..0000000
--- a/peripheral/libupm/examples/javascript/guvas12d.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var UVSensor = require('jsupm_guvas12d');
-
-// Instantiate a UV sensor on analog pin A0
-var myUVSensor = new UVSensor.GUVAS12D(0);
-
-// analog voltage, usually 3.3 or 5.0
-var g_GUVAS12D_AREF = 5.0;
-var g_SAMPLES_PER_QUERY = 1024;
-
-setInterval(function()
-{
- var outputStr = "AREF: " + g_GUVAS12D_AREF
- + ", Voltage value (higher means more UV): "
- + roundNum(myUVSensor.value(g_GUVAS12D_AREF, g_SAMPLES_PER_QUERY), 6);
- console.log(outputStr);
-}, 1000);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum) * (Math.pow(10, decimalPlaces))) / Math.pow(10, decimalPlaces));
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/h3lis331dl.js b/peripheral/libupm/examples/javascript/h3lis331dl.js
deleted file mode 100644
index ae38cd5..0000000
--- a/peripheral/libupm/examples/javascript/h3lis331dl.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Jon Trulson <jtrulson@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var digitalAccelerometer = require('jsupm_h3lis331dl');
-
-// Instantiate an H3LIS331DL on I2C bus 0
-var myDigitalAccelerometer = new digitalAccelerometer.H3LIS331DL(
- digitalAccelerometer.H3LIS331DL_I2C_BUS,
- digitalAccelerometer.H3LIS331DL_DEFAULT_I2C_ADDR);
-
-// Initialize the device with default values
-myDigitalAccelerometer.init();
-
-var x, y, z;
-x = digitalAccelerometer.new_intp();
-y = digitalAccelerometer.new_intp();
-z = digitalAccelerometer.new_intp();
-
-var ax, ay, az;
-ax = digitalAccelerometer.new_floatp();
-ay = digitalAccelerometer.new_floatp();
-az = digitalAccelerometer.new_floatp();
-
-var outputStr;
-
-var myInterval = setInterval(function()
-{
- myDigitalAccelerometer.update();
- myDigitalAccelerometer.getRawXYZ(x, y, z);
- outputStr = "Raw: X = " + digitalAccelerometer.intp_value(x) +
- " Y = " + digitalAccelerometer.intp_value(y) +
- " Z = " + digitalAccelerometer.intp_value(z);
- console.log(outputStr);
-
- myDigitalAccelerometer.getAcceleration(ax, ay, az);
- outputStr = "Acceleration: AX = "
- + roundNum(digitalAccelerometer.floatp_value(ax), 6)
- + " AY = " + roundNum(digitalAccelerometer.floatp_value(ay), 6)
- + " AZ = " + roundNum(digitalAccelerometer.floatp_value(az), 6);
- console.log(outputStr);
-}, 500);
-
-// round off output to match C example, which has 6 decimal places
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum)
- * (Math.pow(10, decimalPlaces))) / Math.pow(10, decimalPlaces));
-}
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
-
- // clean up memory
- digitalAccelerometer.delete_intp(x);
- digitalAccelerometer.delete_intp(y);
- digitalAccelerometer.delete_intp(z);
-
- digitalAccelerometer.delete_floatp(ax);
- digitalAccelerometer.delete_floatp(ay);
- digitalAccelerometer.delete_floatp(az);
-
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hdxxvxta.js b/peripheral/libupm/examples/javascript/hdxxvxta.js
deleted file mode 100644
index 628c85c..0000000
--- a/peripheral/libupm/examples/javascript/hdxxvxta.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_hdxxvxta');
-
-
-/************** Main code **************/
-
-console.log("Initializing...");
-
-// Instantiate an HDXXVXTA instance, using A1 for humidity and A0
-// for temperature
-var sensor = new sensorObj.HDXXVXTA(1, 0);
-
-// update and print available values every second
-setInterval(function()
-{
- // update our values from the sensor
- sensor.update();
-
- // we show both C and F for temperature
- console.log("Temperature:", sensor.getTemperature(),
- "C /", sensor.getTemperature(true), "F");
-
- console.log("Humidity:", sensor.getHumidity(), "%");
-
- console.log("");
-
-}, 1000);
-
-
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hm11.js b/peripheral/libupm/examples/javascript/hm11.js
deleted file mode 100644
index 326f61e..0000000
--- a/peripheral/libupm/examples/javascript/hm11.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-
-/************** Variables **************/
-// normal read/write mode
-var bufferLength = 256;
-
-var ble = require('jsupm_hm11');
-
-
-/************** Functions **************/
-function printUsage(progname)
-{
- var outputStr = "Usage: " + progname + " [AT command]\n\n" +
- "If an argument is supplied on the command line, that argument is\n" +
- "sent to the module and the response is printed out.\n\n" +
- "If no argument is used, then the address and PIN of the module\n" +
- "are queried and the results printed out.\n\n"
- console.log(outputStr);
-}
-
-// simple helper function to send a command and wait for a response
-function sendCommand(bleObj, cmd, callback)
-{
- var bleBuffer = new ble.charArray(bufferLength);
- bleObj.writeData(cmd, cmd.length);
-
- // wait up to 1 second
- if (bleObj.dataAvailable(1000))
- {
- bleObj.readData(bleBuffer, bufferLength);
- var bleData = "";
- // read only the number of characters
- // specified by myGPSSensor.readData
- for (var x = 0; x < bufferLength; x++)
- {
- if (bleBuffer.getitem(x) == '\0')
- break;
- else
- bleData += bleBuffer.getitem(x);
- }
- console.log(bleData);
- }
- else
- console.log("Timed out waiting for response");
- if (callback)
- callback();
-}
-
-/************** Main code **************/
-// Instantiate a HM11 BLE Module on UART 0
-var my_ble_obj = new ble.HM11(0);
-
-// make sure port is initialized properly. 9600 baud is the default.
-if (!my_ble_obj.setupTty(ble.int_B9600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(0);
-}
-
-printUsage(process.argv[1]);
-
-// Note: in nodeJS, command-line argument 0 is "node".
-// Command-line argument 1 is "hm11.js"
-// If you have a third argument, then it's a command for BLE
-if (process.argv.length > 2)
-{
- console.log("Sending command line argument (" + process.argv[2] + ")...");
- sendCommand(my_ble_obj, process.argv[2]);
-}
-else
-{
- // query the module address
- var addr = "AT+ADDR?";
- console.log("Querying module address (" + addr + ")...");
-
- // sending this command as a synchronous callback ensures better timing
- var callbackFunc = function()
- {
- setTimeout(function()
- {
- // query the module address
- var pin = "AT+PASS?";
- console.log("Querying module PIN (" + pin + ")...");
- sendCommand(my_ble_obj, pin);
-
- // Other potentially useful commands are:
- //
- // AT+VERS? - query module version
- // AT+ROLE0 - set as slave
- // AT+ROLE1 - set as master
- // AT+CLEAR - clear all previous settings
- // AT+RESET - restart the device
- //
- // A comprehensive list is available from the datasheet at:
- // http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
- }, 1000);
- };
- sendCommand(my_ble_obj, addr, callbackFunc);
-}
-
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- my_ble_obj = null;
- ble.cleanUp();
- ble = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hmc5883l.js b/peripheral/libupm/examples/javascript/hmc5883l.js
deleted file mode 100644
index c70a60d..0000000
--- a/peripheral/libupm/examples/javascript/hmc5883l.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load Compass module
-var hmc5883l = require('jsupm_hmc5883l');
-// load this on i2c
-var myCompass = new hmc5883l.Hmc5883l(0);
-// Set your declination from true north in radians
-myCompass.set_declination(0.2749);
-
-var coordsObj;
-// Print out the coordinates, heading, and direction every second
-setInterval(function()
-{
- myCompass.update(); // Update the coordinates
- coordsObj = myCompass.coordinates();
- var coords = (coordsObj.getitem(0) + " ");
- coords += (coordsObj.getitem(1) + " ");
- coords += coordsObj.getitem(2);
- var heading = round2Digits(myCompass.heading());
- var direction = round2Digits(myCompass.direction());
- var compassResults = "coords: " + coords +
- " heading: " + heading + " direction " + direction;
- console.log(compassResults);
-}, 1000);
-
-function round2Digits(num)
-{
- return Math.round((num + 0.00001) * 100) / 100;
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hmtrp.js b/peripheral/libupm/examples/javascript/hmtrp.js
deleted file mode 100644
index 3bdd0f2..0000000
--- a/peripheral/libupm/examples/javascript/hmtrp.js
+++ /dev/null
@@ -1,161 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-function printUsage()
-{
- var outputStr = "Usage:\n" +
- "Pass a commandline argument (any argument) to this program\n" +
- "to query the radio configuration and output it. NOTE: the\n" +
- "radio must be in CONFIG mode for this to work.\n\n" +
- "Running this program without arguments will simply transmit\n" +
- "'Hello World!' every second, and output any data received from\n" +
- "another radio.\n\n";
- console.log(outputStr);
-}
-
-var HMTRP_Radio = require('jsupm_hmtrp');
-
-// Instantiate a HMTRP radio device on uart 0
-var my_HMTRP_Radio = new HMTRP_Radio.HMTRP(0);
-
-var g_myInterval;
-var g_counter = 0;
-
-// normal read/write mode
-var bufferLength = 256;
-var radioBuffer = new HMTRP_Radio.charArray(bufferLength);
-
-// make sure port is initialized properly. 9600 baud is the default.
-if (!my_HMTRP_Radio.setupTty(HMTRP_Radio.int_B9600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(0);
-}
-
-printUsage();
-
-// By default, this radio simply transmits data sent via writeData()
-// and reads any available data via readData().
-
-// It can be placed into a configuration mode by grounding the
-// CONFIG pin on the module. When this is done, the various
-// configuration query and config methods can be used. In this
-// example, by default, we just read any data available fom the
-// device, and periodically transmit "Hello World".
-
-// If any argument was specified on the command line, do a simple
-// configuration query and output the results. The radio must be in
-// CONFIG mode for this to work.
-
-
-// Note that the first command-line argument
-// should be "node" and the second is "hmtrp.js".
-// The data we want would be the third... if it exists
-if (process.argv.length > 2)
-{
- // config mode
- var freq = new HMTRP_Radio.uint32Array(0);
- var dataRate = new HMTRP_Radio.uint32Array(0);
- var rxBandwidth = new HMTRP_Radio.uint16Array(0);
- var modulation = new HMTRP_Radio.uint8Array(0);
- var txPower = new HMTRP_Radio.uint8Array(0);
- var uartBaud = new HMTRP_Radio.uint32Array(0);
-
- if (my_HMTRP_Radio.getConfig(
- freq, dataRate, rxBandwidth, modulation, txPower, uartBaud))
- {
- console.log("Radio configuration:");
- var outputStr = "freq: " + freq.getitem(0) +
- " dataRate: " + dataRate.getitem(0) +
- " rxBandwidth: " + rxBandwidth.getitem(0) + "Khz";
- console.log(outputStr);
-
- outputStr = "modulation: " + parseInt(modulation.getitem(0));
- outputStr += " Khz txPower: " + parseInt(txPower.getitem(0));
- outputStr += " uartBaud: " + uartBaud.getitem(0);
- console.log(outputStr);
- }
- else
- {
- var errString = "getConfig() failed. Make sure the radio " +
- "is in CONFIG mode.";
- console.log(errString);
- }
-}
-else
-{
- console.log("Running in normal read/write mode.");
- g_myInterval = setInterval(runRadio, 100); // 100ms
-}
-
-function runRadio()
-{
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (my_HMTRP_Radio.dataAvailable())
- {
- var rv = my_HMTRP_Radio.readData(radioBuffer, bufferLength);
-
- if (rv > 0)
- {
- var resultStr = "";
- for (var x = 0; x < rv; x++)
- resultStr += radioBuffer.getitem(x);
- console.log("Received: " + resultStr);
- }
-
- if (rv < 0) // some sort of read error occured
- {
- console.log("Port read error.");
- return;
- }
- }
- g_counter++;
- // every second, transmit "Hello World"
- if (g_counter > 10)
- {
- var msg = "Hello World!";
-
- console.log("Transmitting " + msg + "...");
-
- // Adding 1 for NULL terminator.
- // Note that SWIG automatically adds a NULL terminator,
- // so no need to NULL-terminate ourselves.
- // Just increment the message length to include
- // the NULL that's already there
- my_HMTRP_Radio.writeData(msg, (msg.length + 1));
- g_counter = 0;
- }
-}
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(g_myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hp20x.js b/peripheral/libupm/examples/javascript/hp20x.js
deleted file mode 100644
index 0447459..0000000
--- a/peripheral/libupm/examples/javascript/hp20x.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var barometerObj = require('jsupm_hp20x');
-
-// Instantiate an HP20X on default I2C bus and address
-var bar = new barometerObj.HP20X();
-
-// Initialize the device with default values
-bar.init();
-
-// Output data every second until interrupted
-setInterval(function()
-{
- console.log("Temperature: " + bar.getTemperature() + " Celcius");
- console.log("Pressure: " + bar.getPressure() + " Millibars");
- console.log("Altitude: " + bar.getAltitude() + " Meters");
- console.log("");
-}, 1000);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- bar = null;
- barometerObj.cleanUp();
- barometerObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/ht9170.js b/peripheral/libupm/examples/javascript/ht9170.js
deleted file mode 100644
index d7bf1ff..0000000
--- a/peripheral/libupm/examples/javascript/ht9170.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var ht9170_dtmf_lib = require("jsupm_ht9170");
-
-// Instantiate a DTMF decoder
-var dtmf_obj = new ht9170_dtmf_lib.HT9170(12, 11, 10, 9, 8);
-
-// Now we just spin in a loop, sleeping every 100ms, checking to see
-// if a digit is available. If so, we decode and print the digit,
-// and continue looping.
-var myInterval = setInterval(function()
-{
- if (dtmf_obj.digitReady())
- {
- console.log("Got DTMF code: " + dtmf_obj.decodeDigit());
- // now spin until digitReady() goes false again
- while (dtmf.digitReady())
- ;
- }
-}, 100);
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- dtmf_obj = null;
- ht9170_dtmf_lib.cleanUp();
- ht9170_dtmf_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hwxpxx.js b/peripheral/libupm/examples/javascript/hwxpxx.js
deleted file mode 100644
index 08269c7..0000000
--- a/peripheral/libupm/examples/javascript/hwxpxx.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_hwxpxx');
-
-
-/************** Main code **************/
-
-var defaultDev = "/dev/ttyUSB0";
-
-// if an argument was specified, use it as the device instead
-if (process.argv.length > 2)
-{
- defaultDev = process.argv[2];
-}
-
-console.log("Using device " + defaultDev);
-console.log("Initializing...");
-
-// Instantiate an HWXPXX instance, using MODBUS slave address 3, and
-// default comm parameters (19200, 8, N, 2)
-var sensor = new sensorObj.HWXPXX(defaultDev, 3);
-
-// output the Slave ID (manufacturer, model, serno)
-console.log("Slave ID:", sensor.getSlaveID());
-
-// stored temperature and humidity offsets
-console.log("Temperature Offset:", sensor.getTemperatureOffset());
-console.log("Humidity Offset:", sensor.getHumidityOffset());
-
-console.log("");
-
-// update and print available values every second
-setInterval(function()
-{
- // update our values from the sensor
- sensor.update();
-
- // we show both C and F for temperature
- console.log("Temperature:", sensor.getTemperature(),
- "C /", sensor.getTemperature(true), "F");
-
- console.log("Humidity:", sensor.getHumidity(), "%");
-
- console.log("Slider:", sensor.getSlider(), "%");
-
- console.log("Override Switch Status:", sensor.getOverrideSwitchStatus());
-
- console.log("");
-
-}, 1000);
-
-
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/hx711.js b/peripheral/libupm/examples/javascript/hx711.js
deleted file mode 100644
index 8393734..0000000
--- a/peripheral/libupm/examples/javascript/hx711.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-*
-* Author: Rafael da Mata Neri <rafael.neri@gmail.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy of
-* this software and associated documentation files (the "Software"), to deal in
-* the Software without restriction, including without limitation the rights to
-* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-* the Software, and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var hx711 = require('jsupm_hx711');
-// Instantiate a HX711 data on digital pin D3 and clock on digital pin D2
-var scale = new hx711.HX711(3, 2);
-
-setTimeout(function(){
- // 2837: value obtained via calibration
- scale.setScale(2837);
- scale.tare(2);
- setInterval(function(){
- console.log(scale.getUnits());
- }, 1000);
-}, 1000);
diff --git a/peripheral/libupm/examples/javascript/ili9341.js b/peripheral/libupm/examples/javascript/ili9341.js
deleted file mode 100644
index ba0f47b..0000000
--- a/peripheral/libupm/examples/javascript/ili9341.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/**
- * Author: Shawn Hymel
- * Copyright (c) 2016 SparkFun Electronics
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var ili9341 = require('jsupm_ili9341');
-
-// Pins (Edison)
-// CS_LCD GP44 (MRAA 31)
-// CS_SD GP43 (MRAA 38) unused
-// DC GP12 (MRAA 20)
-// RESEST GP13 (MRAA 14)
-var lcd = new ili9341.ILI9341(31, 38, 20, 14);
-
-// Fill the screen with a solid color
-lcd.fillScreen(lcd.color565(0, 40, 16));
-
-// Draw some shapes
-lcd.drawFastVLine(10, 10, 100, ili9341.ILI9341_RED);
-lcd.drawFastHLine(20, 10, 50, ili9341.ILI9341_CYAN);
-lcd.drawLine(160, 30, 200, 60, ili9341.ILI9341_GREEN);
-lcd.fillRect(20, 30, 75, 60, ili9341.ILI9341_ORANGE);
-lcd.drawCircle(70, 50, 20, ili9341.ILI9341_PURPLE);
-lcd.fillCircle(120, 50, 20, ili9341.ILI9341_PURPLE);
-lcd.drawTriangle(50, 100, 10, 140, 90, 140, ili9341.ILI9341_YELLOW);
-lcd.fillTriangle(150, 100, 110, 140, 190, 140, ili9341.ILI9341_YELLOW);
-lcd.drawRoundRect(20, 150, 50, 30, 10, ili9341.ILI9341_RED);
-lcd.drawRoundRect(130, 150, 50, 30, 10, ili9341.ILI9341_RED);
-lcd.fillRoundRect(75, 150, 50, 30, 10, ili9341.ILI9341_RED);
-
-// Write some text
-lcd.setCursor(0, 200);
-lcd.setTextColor(ili9341.ILI9341_LIGHTGREY);
-lcd.setTextWrap(true);
-lcd.setTextSize(1);
-lcd.print("Text 1\n");
-lcd.setTextSize(2);
-lcd.print("Text 2\n");
-lcd.setTextSize(3);
-lcd.print("Text 3\n");
-lcd.setTextSize(4);
-lcd.print("Text 4\n");
-
-// Test screen rotation
-function rotateScreen(r) {
- lcd.setRotation(r);
- lcd.fillRect(0, 0, 5, 5, ili9341.ILI9341_WHITE);
- if (r < 4) {
- r++;
- setTimeout(function() { rotateScreen(r); }, 1000);
- }
-}
-rotateScreen(0);
-
-// Invert colors, wait, then revert back
-setTimeout(function() { lcd.invertDisplay(true); }, 4000);
-setTimeout(function() { lcd.invertDisplay(false); }, 6000); \ No newline at end of file
diff --git a/peripheral/libupm/examples/javascript/ina132.js b/peripheral/libupm/examples/javascript/ina132.js
deleted file mode 100644
index 554c3a0..0000000
--- a/peripheral/libupm/examples/javascript/ina132.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var differential_amplifier_lib = require("jsupm_ina132");
-
-// Tested with the INA132 Differential Amplifier Sensor module.
-// Instantiate an INA132 on analog pin A0
-var differential_amplifier_obj = new differential_amplifier_lib.INA132(0);
-
-var myInterval = setInterval(function()
-{
- console.log(roundNum(differential_amplifier_obj.value(), 5));
-}, 1000);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- var numerator = Math.round((num + extraNum) * (Math.pow(10, decimalPlaces)));
- var denominator = Math.pow(10, decimalPlaces);
- return (numerator / denominator);
-}
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- differential_amplifier_obj = null;
- differential_amplifier_lib.cleanUp();
- differential_amplifier_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/isd1820.js b/peripheral/libupm/examples/javascript/isd1820.js
deleted file mode 100644
index 628dff6..0000000
--- a/peripheral/libupm/examples/javascript/isd1820.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var recorder_lib = require("jsupm_isd1820");
-
-// Instantiate a ISD1820 on digital pins 2 (play) and 3 (record)
-// This example was tested on the Grove Recorder.
-var myRecorder = new recorder_lib.ISD1820(2, 3);
-
-
-var doRecord = false;
-
-if (process.argv.length > 2)
- doRecord = true;
-
-// if an argument was specified (any argument), go into record mode,
-// else playback a previously recorded sample
-console.log("Supply any argument to the command line to record.");
-console.log("Running this example without arguments will play back ");
-console.log("any previously recorded sound.");
-console.log("There is approximately 10 seconds of recording time.\n");
-
-// depending on what was selected, do it, and sleep for 15 seconds
-if (doRecord)
- myRecorder.record(true);
-else
- myRecorder.play(true);
-
-// There are about 10 seconds of recording/playback time, so we will
-// sleep for a little extra time.
-console.log("Sleeping for 15 seconds...");
-
-setTimeout(function()
-{
- // turn off whatever we were doing.
- if (doRecord)
- myRecorder.record(false);
- else
- myRecorder.play(false);
- console.log("Exiting");
- myRecorder = null;
- recorder_lib.cleanUp();
- recorder_lib = null;
- process.exit(0);
-}, 15 * 1000);
diff --git a/peripheral/libupm/examples/javascript/itg3200.js b/peripheral/libupm/examples/javascript/itg3200.js
deleted file mode 100644
index 4ed6883..0000000
--- a/peripheral/libupm/examples/javascript/itg3200.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Sarah Knepper <sarah.knepper@intel.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load gyroscope module
-var itg3200 = require('jsupm_itg3200');
-// load this on i2c
-var gyro = new itg3200.Itg3200(0);
-
-var rot;
-var ang;
-
-// Note: Sensor not supported on Intel Edison with Arduino breakout
-setInterval(function()
-{
- gyro.update(); // Update the data
- rot = gyro.getRawValues(); // Read raw sensor data
- ang = gyro.getRotation(); // Read rotational speed (deg/sec)
- var rots = (rot.getitem(0) + " ");
- rots += (rot.getitem(1) + " ");
- rots += rot.getitem(2);
- var temp = round2Digits(gyro.getTemperature());
- var raw = round2Digits(gyro.getRawTemp());
- console.log("Raw: " + rots);
- console.log("AngX: " + round2Digits(ang.getitem(0)));
- console.log("AngY: " + round2Digits(ang.getitem(1)));
- console.log("AngZ: " + round2Digits(ang.getitem(2)));
- console.log("Temp: " + temp + " Raw: " + raw);
-}, 1000);
-
-function round2Digits(num)
-{
- return Math.round((num + 0.00001) * 100) / 100;
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/jhd1313m1-lcd.js b/peripheral/libupm/examples/javascript/jhd1313m1-lcd.js
deleted file mode 100644
index 5699aac..0000000
--- a/peripheral/libupm/examples/javascript/jhd1313m1-lcd.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
- * Author: Zion Orent <zorent@ics.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load lcd module on I2C
-var LCD = require('jsupm_i2clcd');
-
-// Initialize Jhd1313m1 at 0x62 (RGB_ADDRESS) and 0x3E (LCD_ADDRESS)
-var myLcd = new LCD.Jhd1313m1 (0, 0x3E, 0x62);
-
-myLcd.setCursor(0,0);
-// RGB Blue
-//myLcd.setColor(53, 39, 249);
-// RGB Red
-myLcd.setColor(255, 0, 0);
-myLcd.write('Hello World');
-myLcd.setCursor(1,2);
-myLcd.write('Hello World');
diff --git a/peripheral/libupm/examples/javascript/joystick12.js b/peripheral/libupm/examples/javascript/joystick12.js
deleted file mode 100644
index 82d73b2..0000000
--- a/peripheral/libupm/examples/javascript/joystick12.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var joystick = require('jsupm_joystick12');
-
-// Instantiate a joystick on analog pins A0 and A1
-var myJoystick = new joystick.Joystick12(0, 1);
-
-// Print the X and Y input values every second
-setInterval(function()
-{
- var XString = "Driving X:" + roundNum(myJoystick.getXInput(), 6);
- var YString = ": and Y:" + roundNum(myJoystick.getYInput(), 6);
- console.log(XString + YString);
-}, 1000);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- var numerator = Math.round((num + extraNum) * (Math.pow(10, decimalPlaces)));
- var denominator = Math.pow(10, decimalPlaces);
- return (numerator / denominator);
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/l298-stepper.js b/peripheral/libupm/examples/javascript/l298-stepper.js
deleted file mode 100644
index ef2bbce..0000000
--- a/peripheral/libupm/examples/javascript/l298-stepper.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var HBridge_lib = require('jsupm_l298');
-
-// Instantiate a Stepper motor on a L298 Dual H-Bridge.
-// This was tested with the NEMA-17 12V, 350mA, with 200 steps per rev.
-var myHBridge_obj = new HBridge_lib.L298(200, 3, 4, 7, 8, 9);
-
-/**************************************
- * Instantiate H-bridge stepper object
-***************************************/
-myHBridge_obj.goForward = function()
-{
- myHBridge_obj.setSpeed(10); // 10 RPMs
- myHBridge_obj.setDirection(HBridge_lib.L298.DIR_CW);
- myHBridge_obj.enable(true);
- console.log("Rotating 1 full revolution at 10 RPM speed.");
- // move 200 steps, a full rev
- myHBridge_obj.stepperSteps(200);
-};
-
-myHBridge_obj.reverseDirection = function()
-{
- console.log("Rotating 1/2 revolution in opposite direction at 10 RPM speed.");
- myHBridge_obj.setDirection(HBridge_lib.L298.DIR_CCW);
- myHBridge_obj.stepperSteps(100);
-};
-
-myHBridge_obj.stop = function()
-{
- myHBridge_obj.enable(false);
-};
-
-myHBridge_obj.quit = function()
-{
- myHBridge_obj = null;
- HBridge_lib.cleanUp();
- HBridge_lib = null;
- console.log("Exiting");
- process.exit(0);
-};
-
-
-/************************
- * Run H-bridge stepper!
-*************************/
-myHBridge_obj.goForward();
-setTimeout(myHBridge_obj.reverseDirection, 2000);
-setTimeout(function()
-{
- myHBridge_obj.stop();
- myHBridge_obj.quit();
-}, 4000);
diff --git a/peripheral/libupm/examples/javascript/l298.js b/peripheral/libupm/examples/javascript/l298.js
deleted file mode 100644
index 8d972cb..0000000
--- a/peripheral/libupm/examples/javascript/l298.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var HBridge_lib = require('jsupm_l298');
-
-// Instantiate one of the 2 possible DC motors on a L298 Dual
-// H-Bridge. For controlling a stepper motor, see the l298-stepper
-// example.
-var myHBridge_obj = new HBridge_lib.L298(3, 4, 7);
-
-/*****************************
- * Instantiate H-bridge object
-******************************/
-myHBridge_obj.goForward = function()
-{
- console.log("Starting motor at 50% for 3 seconds...");
- myHBridge_obj.setSpeed(50);
- myHBridge_obj.setDirection(HBridge_lib.L298.DIR_CW);
- myHBridge_obj.enable(true);
-};
-
-myHBridge_obj.reverseDirection = function()
-{
- console.log("Reversing direction...");
- myHBridge_obj.setDirection(HBridge_lib.L298.DIR_NONE); // fast stop
- myHBridge_obj.setDirection(HBridge_lib.L298.DIR_CCW);
-};
-
-myHBridge_obj.stop = function()
-{
- myHBridge_obj.setSpeed(0);
- myHBridge_obj.enable(false);
-};
-
-myHBridge_obj.quit = function()
-{
- myHBridge_obj = null;
- HBridge_lib.cleanUp();
- HBridge_lib = null;
- console.log("Exiting");
- process.exit(0);
-};
-
-
-/************************
- * Run H-bridge!
-*************************/
-myHBridge_obj.goForward();
-setTimeout(myHBridge_obj.reverseDirection, 3000);
-setTimeout(function()
-{
- myHBridge_obj.stop();
- myHBridge_obj.quit();
-}, 6000);
diff --git a/peripheral/libupm/examples/javascript/ldt0028.js b/peripheral/libupm/examples/javascript/ldt0028.js
deleted file mode 100644
index e57dbc6..0000000
--- a/peripheral/libupm/examples/javascript/ldt0028.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load Grove module
-var sensorModule = require('jsupm_ldt0028');
-
-var NUMBER_OF_SECONDS = 10;
-var MILLISECONDS_PER_SECOND = 1000;
-var SAMPLES_PER_SECOND = 50;
-var THRESHOLD = 100;
-
-// Create the LDT0-028 Piezo Vibration Sensor object using AIO pin 0
-var sensor = new sensorModule.LDT0028(0);
-
-// Read the signal every 20 milliseconds for 10 seconds
-console.log("For the next " + NUMBER_OF_SECONDS + " seconds, " +
- SAMPLES_PER_SECOND + " samples will be taken every second.");
-console.log("");
-var buffer = [];
-for (var i=0; i < NUMBER_OF_SECONDS * SAMPLES_PER_SECOND; i++) {
- buffer.push(sensor.getSample());
- delay(MILLISECONDS_PER_SECOND / SAMPLES_PER_SECOND );
-}
-
-// Print the number of times the reading was greater than the threshold
-var count = 0;
-for (var i=0; i < NUMBER_OF_SECONDS * SAMPLES_PER_SECOND; i++) {
- if (buffer[i] > THRESHOLD) {
- count++;
- }
-}
-console.log(sensor.name() + " exceeded the threshold value of " +
- THRESHOLD + " a total of " + count + " times,");
-console.log("out of a total of " + NUMBER_OF_SECONDS*SAMPLES_PER_SECOND +
- " readings.");
-console.log("");
-
-// Print a graphical representation of the average value sampled
-// each second for the past 10 seconds, using a scale factor of 15
-console.log("Now printing a graphical representation of the average reading ");
-console.log("each second for the last " + NUMBER_OF_SECONDS + " seconds.");
-var SCALE_FACTOR = 15;
-for (var i=0; i < NUMBER_OF_SECONDS; i++) {
- var sum = 0;
- for (var j=0; j < SAMPLES_PER_SECOND; j++) {
- sum += buffer[i*SAMPLES_PER_SECOND+j];
- }
- var average = sum / SAMPLES_PER_SECOND;
- var stars_to_print = Math.round(average / SCALE_FACTOR);
- var string = "(" + (" " + Math.round(average)).slice(-4) + ") | ";
- for (var j=0; j < stars_to_print; j++) {
- string += "*";
- }
- console.log(string);
-}
-
-function delay( milliseconds ) {
- var startTime = Date.now();
- while (Date.now() - startTime < milliseconds);
-}
-
diff --git a/peripheral/libupm/examples/javascript/lm35.js b/peripheral/libupm/examples/javascript/lm35.js
deleted file mode 100644
index 86f029e..0000000
--- a/peripheral/libupm/examples/javascript/lm35.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_lm35');
-
-// Instantiate a LM35 on analog pin A0, with a default analog
-// reference voltage of 5.0
-var sensor = new sensorObj.LM35(0);
-
-// Every half second, sample the sensor and output the temperature
-
-setInterval(function()
-{
- console.log("Temperature: " + sensor.getTemperature() + " C");
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/loudness.js b/peripheral/libupm/examples/javascript/loudness.js
deleted file mode 100644
index 94485a3..0000000
--- a/peripheral/libupm/examples/javascript/loudness.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_loudness');
-
-// Instantiate a Loudness sensor on analog pin A0, with an analog
-// reference voltage of 5.0
-var sensor = new sensorObj.Loudness(0, 5.0);
-
-// Every tenth of a second, sample the loudness and output it's
-// corresponding analog voltage.
-
-setInterval(function()
-{
- console.log("Detected loudness (volts): " + sensor.loudness());
-}, 100);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/lsm303.js b/peripheral/libupm/examples/javascript/lsm303.js
deleted file mode 100644
index 376b7b4..0000000
--- a/peripheral/libupm/examples/javascript/lsm303.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var accelrCompassSensor = require('jsupm_lsm303');
-
-// Instantiate LSM303 compass on I2C
-var myAccelrCompass = new accelrCompassSensor.LSM303(0);
-
-var successFail, coords, outputStr, accel;
-var myInterval = setInterval(function()
-{
- // Load coordinates into LSM303 object
- successFail = myAccelrCompass.getCoordinates();
- // in XYZ order. The sensor returns XZY,
- // but the driver compensates and makes it XYZ
- coords = myAccelrCompass.getRawCoorData();
-
- // Print out the X, Y, and Z coordinate data using two different methods
- outputStr = "coor: rX " + coords.getitem(0)
- + " - rY " + coords.getitem(1)
- + " - rZ " + coords.getitem(2);
- console.log(outputStr);
- outputStr = "coor: gX " + myAccelrCompass.getCoorX()
- + " - gY " + myAccelrCompass.getCoorY()
- + " - gZ " + myAccelrCompass.getCoorZ();
- console.log(outputStr);
-
- // Get and print out the heading
- console.log("heading: " + myAccelrCompass.getHeading());
-
- // Get the acceleration
- myAccelrCompass.getAcceleration();
- accel = myAccelrCompass.getRawAccelData();
- // Print out the X, Y, and Z acceleration data using two different methods
- outputStr = "acc: rX " + accel.getitem(0)
- + " - rY " + accel.getitem(1)
- + " - Z " + accel.getitem(2);
- console.log(outputStr);
- outputStr = "acc: gX " + myAccelrCompass.getAccelX()
- + " - gY " + myAccelrCompass.getAccelY()
- + " - gZ " + myAccelrCompass.getAccelZ();
- console.log(outputStr);
- console.log(" ");
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myAccelrCompass = null;
- accelrCompassSensor.cleanUp();
- accelrCompassSensor = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/lsm9ds0.js b/peripheral/libupm/examples/javascript/lsm9ds0.js
deleted file mode 100644
index a984457..0000000
--- a/peripheral/libupm/examples/javascript/lsm9ds0.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_lsm9ds0');
-
-// Instantiate an LSM9DS0 using default parameters (bus 1, gyro addr 6b,
-// xm addr 1d)
-var sensor = new sensorObj.LSM9DS0();
-
-// Initialize the device with default values
-sensor.init();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getAccelerometer(x, y, z);
- console.log("Accelerometer: AX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getGyroscope(x, y, z);
- console.log("Gyroscope: GX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getMagnetometer(x, y, z);
- console.log("Magnetometer: MX: " + sensorObj.floatp_value(x) +
- " MY: " + sensorObj.floatp_value(y) +
- " MZ: " + sensorObj.floatp_value(z));
-
- console.log("Temperature: " + sensor.getTemperature());
-
- console.log();
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/m24lr64e.js b/peripheral/libupm/examples/javascript/m24lr64e.js
deleted file mode 100644
index b022efd..0000000
--- a/peripheral/libupm/examples/javascript/m24lr64e.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var nfcTagObj = require('jsupm_m24lr64e');
-
-// Instantiate a M24LR64E Grove NFC Tag Module on UART 0
-var nfcTag = new nfcTagObj.M24LR64E(nfcTagObj.M24LR64E_I2C_BUS);
-
-// This example accesses the device in the 'user' (default) mode,
-// reads the last byte of data in the EEPROM, inverts it, writes
-// it back, and then re-reads it.
-
-// Read the last byte of the EEPROM area
-var addr = (nfcTagObj.M24LR64E.EEPROM_I2C_LENGTH - 1);
-console.log("Address: " + addr);
-var byte = nfcTag.readByte(addr);
-
-console.log("Read byte: " + byte.toString(16));
-
-// Now change it to it's opposite and write it
-byte = (~byte & 0xff);
-nfcTag.writeByte(addr, byte);
-console.log("Wrote inverted byte: " + byte.toString(16));
-
-// Now read it back.
-byte = nfcTag.readByte(addr);
-console.log("Read byte: " + byte.toString(16));
-
-// clean up
-nfcTag = null;
-nfcTagObj.cleanUp();
-nfcTagObj = null;
-console.log("Exiting...");
-process.exit(0);
diff --git a/peripheral/libupm/examples/javascript/maxsonarez.js b/peripheral/libupm/examples/javascript/maxsonarez.js
deleted file mode 100644
index 3393b48..0000000
--- a/peripheral/libupm/examples/javascript/maxsonarez.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Jon Trulson <jtrulson@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// JavaScript example for the MaxSonar-EZ family of ultrasonic range finders
-
-// analog voltage, usually 3.3 or 5.0
-var MAXSONAREZ_AREF = 5.0;
-
-var MaxSonarEZ = require('jsupm_maxsonarez');
-
-// Instantiate a MaxSonar-EZ on analog pin A1, with an analog
-// reference voltage of MAXSONAREZ_AREF
-var mySonar = new MaxSonarEZ.MAXSONAREZ(1, MAXSONAREZ_AREF);
-
-// Every second, sample the sonar and output the distance to an
-// object in inches.
-
-// With the EZ3 version, the minimum and maximum ranges seemed to be
-// between 6 and 33 inches
-
-var myInterval = setInterval(function()
-{
- console.log("AREF: " + MAXSONAREZ_AREF +
- ", distance in inches: " + mySonar.inches());
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- mySonar = null;
- MaxSonarEZ.cleanUp();
- MaxSonarEZ = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mcp9808.js b/peripheral/libupm/examples/javascript/mcp9808.js
deleted file mode 100644
index eca142a..0000000
--- a/peripheral/libupm/examples/javascript/mcp9808.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-// Leave the above lines for propper jshinting
-//Type Node.js Here :)
-/*
-* The MIT License
-*
-* Author: Marc Graham <marc@m2ag.net>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var mcp = require('jsupm_mcp9808');
-
-var temp = new mcp.MCP9808(6);
-
-console.log(temp.getTemp());
-
-//Sleep mode:
-temp.shutDown();
-//wake up
-temp.shutDown(false);
-//set mode to report fahrenheit
-temp.setMode(false);
-//check reporting mode
-console.log(temp.isCelsius()) //False = fahrenheit
-//set mode to celsius
-temp.setMode();
-//read temp
-temp.getTemp();
-//check Tcrit, Tupper or Tlower status bits
-temp.isTcrit(); // true if over boundry.
-temp.isTupper();
-temp.isTlower();
-//set the values of monitior registers
-temp.setMonitorReg(mcp.MCP9808.CRIT_TEMP, 23);
-temp.setMonitorReg(mcp.MCP9808.LOWER_TEMP, 20);
-temp.setMonitorReg(mcp.MCP9808.UPPER_TEMP, 22);
-//read MonitorReg
-console.log("Tcrit = " + temp.getMonitorReg(mcp.MCP9808.CRIT_TEMP));
-console.log("Tcrit = " + temp.getMonitorReg(mcp.MCP9808.LOWER_TEMP));
-console.log("Tcrit = " + temp.getMonitorReg(mcp.MCP9808.UPPER_TEMP));
-
-
-process.exit(0);
-
-
-
-
-
-
- \ No newline at end of file
diff --git a/peripheral/libupm/examples/javascript/mg811.js b/peripheral/libupm/examples/javascript/mg811.js
deleted file mode 100644
index 21e63a8..0000000
--- a/peripheral/libupm/examples/javascript/mg811.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_mg811');
-
-// Instantiate an MG811 on analog pin A0, and digital pin D2 with an
-// analog reference voltage of MG811_AREF (5.0)
-
-var sensor = new sensorObj.MG811(0, 2, 5.0);
-
-// Every tenth of a second, sample the sensor and output it's
-// detected CO2 concentration in parts per million (ppm)
-
-setInterval(function()
-{
- console.log("CO2 concentration in PPM: " + sensor.ppm());
-}, 100);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/mhz16.js b/peripheral/libupm/examples/javascript/mhz16.js
deleted file mode 100644
index 71ded00..0000000
--- a/peripheral/libupm/examples/javascript/mhz16.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var CO2_lib = require('jsupm_mhz16');
-
-// Instantiate a MHZ16 serial CO2 sensor on uart 0.
-// This example was tested on the Grove CO2 sensor module.
-var myCO2_obj = new CO2_lib.MHZ16(0);
-
-// make sure port is initialized properly. 9600 baud is the default.
-if (!myCO2_obj.setupTty(CO2_lib.int_B9600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(0);
-}
-
-outputStr = "Make sure that the sensor has had " +
- "at least 3 minutes to warm up";
-console.log(outputStr);
-outputStr = "or you will not get valid results.";
-console.log(outputStr);
-outputStr = "The temperature reported is not the ambient temperature,";
-console.log(outputStr);
-outputStr = "but rather the temperature of the sensor elements.";
-console.log(outputStr);
-
-function writeCO2data()
-{
- if (!myCO2_obj.getData())
- console.log("Failed to retrieve data");
- else
- {
- outputStr = "CO2 concentration: " + myCO2_obj.getGas() +
- " PPM, " +
- "Temperature (in C): " + myCO2_obj.getTemperature();
- console.log(outputStr);
- }
-}
-var myInterval;
-setTimeout(function()
-{
- myInterval = setInterval(writeCO2data, 2000);
-}, 1000);
-
-
-// Print message, clear memory when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myCO2_obj = null;
- CO2_lib.cleanUp();
- CO2_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mic.js b/peripheral/libupm/examples/javascript/mic.js
deleted file mode 100644
index f77e2cf..0000000
--- a/peripheral/libupm/examples/javascript/mic.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmMicrophone = require("jsupm_mic");
-
-// Attach microphone to analog port A0
-var myMic = new upmMicrophone.Microphone(0);
-
-var threshContext = new upmMicrophone.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-var is_running = false;
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 microseconds;
-// find the average of 128 samples; and
-// print a running graph of the averages
-while(1)
-{
- var buffer = new upmMicrophone.uint16Array(128);
- var len = myMic.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = myMic.findThreshold(threshContext, 30, buffer, len);
- myMic.printGraph(threshContext);
- if (thresh)
- console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/micsv89.js b/peripheral/libupm/examples/javascript/micsv89.js
deleted file mode 100644
index ff69c56..0000000
--- a/peripheral/libupm/examples/javascript/micsv89.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// Drive the Grive RGB LCD (a JHD1313m1)
-//
-// The way to drive the LCD directly from
-// Javascript code using the i2c interface directly
-// This approach is useful for learning about using
-// the i2c bus. The i2c file is an implementation
-// in Javascript for some of the common LCD functions
-
-// configure jshint
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-var upmMICSV89 = require("jsupm_micsv89");
-
-var mics = new upmMICSV89.MICSV89(6);
-
-while(1)
-{
- mics.update();
- while(!mics.valid());
- console.log("co2: " + mics.co2equ());
- console.log("short: " + mics.vocshort());
- console.log("tvoc: " + mics.tvoc());
- console.log("resistor: " + mics.resistor());
- console.log("***********************");
-}
diff --git a/peripheral/libupm/examples/javascript/mma7660.js b/peripheral/libupm/examples/javascript/mma7660.js
deleted file mode 100644
index 32b419f..0000000
--- a/peripheral/libupm/examples/javascript/mma7660.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var digitalAccelerometer = require('jsupm_mma7660');
-
-// Instantiate an MMA7660 on I2C bus 0
-var myDigitalAccelerometer = new digitalAccelerometer.MMA7660(
- digitalAccelerometer.MMA7660_I2C_BUS,
- digitalAccelerometer.MMA7660_DEFAULT_I2C_ADDR);
-
-// place device in standby mode so we can write registers
-myDigitalAccelerometer.setModeStandby();
-
-// enable 64 samples per second
-myDigitalAccelerometer.setSampleRate(digitalAccelerometer.MMA7660.AUTOSLEEP_64);
-
-// place device into active mode
-myDigitalAccelerometer.setModeActive();
-
-var x, y, z;
-x = digitalAccelerometer.new_intp();
-y = digitalAccelerometer.new_intp();
-z = digitalAccelerometer.new_intp();
-
-var ax, ay, az;
-ax = digitalAccelerometer.new_floatp();
-ay = digitalAccelerometer.new_floatp();
-az = digitalAccelerometer.new_floatp();
-
-var outputStr;
-
-var myInterval = setInterval(function()
-{
- myDigitalAccelerometer.getRawValues(x, y, z);
- outputStr = "Raw values: x = " + digitalAccelerometer.intp_value(x) +
- " y = " + digitalAccelerometer.intp_value(y) +
- " z = " + digitalAccelerometer.intp_value(z);
- console.log(outputStr);
-
- myDigitalAccelerometer.getAcceleration(ax, ay, az);
- outputStr = "Acceleration: x = "
- + roundNum(digitalAccelerometer.floatp_value(ax), 6)
- + "g y = " + roundNum(digitalAccelerometer.floatp_value(ay), 6)
- + "g z = " + roundNum(digitalAccelerometer.floatp_value(az), 6) + "g";
- console.log(outputStr);
-}, 500);
-
-// round off output to match C example, which has 6 decimal places
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum)
- * (Math.pow(10, decimalPlaces))) / Math.pow(10, decimalPlaces));
-}
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
-
- // clean up memory
- digitalAccelerometer.delete_intp(x);
- digitalAccelerometer.delete_intp(y);
- digitalAccelerometer.delete_intp(z);
-
- digitalAccelerometer.delete_floatp(ax);
- digitalAccelerometer.delete_floatp(ay);
- digitalAccelerometer.delete_floatp(az);
-
- myDigitalAccelerometer.setModeStandby();
-
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mpr121.js b/peripheral/libupm/examples/javascript/mpr121.js
deleted file mode 100644
index a619f41..0000000
--- a/peripheral/libupm/examples/javascript/mpr121.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var touchSensor = require('jsupm_mpr121');
-
-var myTouchSensor = new touchSensor.MPR121(touchSensor.MPR121_I2C_BUS, touchSensor.MPR121_DEFAULT_I2C_ADDR);
-
-myTouchSensor.configAN3944();
-
-setInterval(function()
-{
- myTouchSensor.readButtons();
- printButtons(myTouchSensor);
-}, 1000);
-
-function printButtons(touchSensor)
-{
- var buttonPressed = false;
-
- var outputStr = "Buttons Pressed: ";
- for (var i=0; i<12; i++)
- {
- if (touchSensor.m_buttonStates & (1 << i))
- {
- outputStr += (i + " ");
- buttonPressed = true;
- }
- }
-
- if (!buttonPressed)
- outputStr += "None";
-
- console.log(outputStr);
-
- if (touchSensor.m_overCurrentFault)
- console.log("Over Current Fault detected!");
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/mpu60x0.js b/peripheral/libupm/examples/javascript/mpu60x0.js
deleted file mode 100644
index 46354b1..0000000
--- a/peripheral/libupm/examples/javascript/mpu60x0.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_mpu9150');
-
-// Instantiate an MPU60X0 on default I2C bus and address
-var sensor = new sensorObj.MPU60X0();
-
-// Initialize the device with default values
-sensor.init();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getAccelerometer(x, y, z);
- console.log("Accelerometer: AX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getGyroscope(x, y, z);
- console.log("Gyroscope: GX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- console.log("Temperature: " + sensor.getTemperature());
-
- console.log();
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/mpu9150.js b/peripheral/libupm/examples/javascript/mpu9150.js
deleted file mode 100644
index 6b3b4d4..0000000
--- a/peripheral/libupm/examples/javascript/mpu9150.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_mpu9150');
-
-// Instantiate an MPU9105 on default I2C bus and address
-var sensor = new sensorObj.MPU9150();
-
-// Initialize the device with default values
-sensor.init();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getAccelerometer(x, y, z);
- console.log("Accelerometer: AX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getGyroscope(x, y, z);
- console.log("Gyroscope: GX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getMagnetometer(x, y, z);
- console.log("Magnetometer: MX: " + sensorObj.floatp_value(x) +
- " MY: " + sensorObj.floatp_value(y) +
- " MZ: " + sensorObj.floatp_value(z));
-
- console.log("Temperature: " + sensor.getTemperature());
-
- console.log();
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/mpu9250.js b/peripheral/libupm/examples/javascript/mpu9250.js
deleted file mode 100644
index b188012..0000000
--- a/peripheral/libupm/examples/javascript/mpu9250.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_mpu9150');
-
-// Instantiate an MPU9105 on default I2C bus and address
-var sensor = new sensorObj.MPU9250();
-
-// Initialize the device with default values
-sensor.init();
-
-var x = new sensorObj.new_floatp();
-var y = new sensorObj.new_floatp();
-var z = new sensorObj.new_floatp();
-
-// Output data every half second until interrupted
-setInterval(function()
-{
- sensor.update();
-
- sensor.getAccelerometer(x, y, z);
- console.log("Accelerometer: AX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getGyroscope(x, y, z);
- console.log("Gyroscope: GX: " + sensorObj.floatp_value(x) +
- " AY: " + sensorObj.floatp_value(y) +
- " AZ: " + sensorObj.floatp_value(z));
-
- sensor.getMagnetometer(x, y, z);
- console.log("Magnetometer: MX: " + sensorObj.floatp_value(x) +
- " MY: " + sensorObj.floatp_value(y) +
- " MZ: " + sensorObj.floatp_value(z));
-
- console.log("Temperature: " + sensor.getTemperature());
-
- console.log();
-
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/mq2.js b/peripheral/libupm/examples/javascript/mq2.js
deleted file mode 100644
index 6e91692..0000000
--- a/peripheral/libupm/examples/javascript/mq2.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmMQ2 = require("jsupm_gas");
-
-// Attach gas sensor to AIO0
-var myMQ2 = new upmMQ2.MQ2(0);
-
-var threshContext = new upmMQ2.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 milliseconds;
-// find the average of 128 samples; and
-// print a running graph of the averages using a resolution of 5
-while(1)
-{
- var buffer = new upmMQ2.uint16Array(128);
- var len = myMQ2.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = myMQ2.findThreshold(threshContext, 30, buffer, len);
- myMQ2.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq3.js b/peripheral/libupm/examples/javascript/mq3.js
deleted file mode 100644
index 607d422..0000000
--- a/peripheral/libupm/examples/javascript/mq3.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmMQ3 = require("jsupm_gas");
-
-// Attach gas sensor to AIO0
-var myMQ3 = new upmMQ3.MQ3(0);
-
-var threshContext = new upmMQ3.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 milliseconds;
-// find the average of 128 samples; and
-// print a running graph of the averages using a resolution of 5
-while(1)
-{
- var buffer = new upmMQ3.uint16Array(128);
- var len = myMQ3.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = myMQ3.findThreshold(threshContext, 30, buffer, len);
- myMQ3.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq303a.js b/peripheral/libupm/examples/javascript/mq303a.js
deleted file mode 100644
index 8cce09c..0000000
--- a/peripheral/libupm/examples/javascript/mq303a.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load alcohol sensor module
-var mq303a = require('jsupm_mq303a');
-
-// Instantiate an mq303a sensor on analog pin A0
-// This device uses a heater powered from an analog I/O pin.
-// If using A0 as the data pin, then you need to use A1, as the heater
-// pin (if using a grove mq303a). For A1, we can use the D15 gpio,
-// setup as an output, and drive it low to power the heater.
-var myAlcoholObj = new mq303a.MQ303A(0, 15);
-
-console.log("Enabling heater and waiting 2 minutes for warmup.");
-
-// give time updates every 30 seconds until 2 minutes have passed
-// for the alcohol sensor to warm up
-statusMessage(1);
-statusMessage(2);
-statusMessage(3);
-
-function statusMessage(amt)
-{
- setTimeout(function()
- {
- console.log((amt * 30) + " seconds have passed");
- }, 30000 * amt);
-}
-
-// run the alcohol sensor in 2 minutes
-setTimeout(runAlcoholSensor, 120000);
-
-function runAlcoholSensor()
-{
- var notice = "This sensor may need to warm " +
- "until the value drops below about 450."
- console.log(notice);
-
- // Print the detected alcohol value every second
- setInterval(function()
- {
- var val = myAlcoholObj.value();
- var msg = "Alcohol detected ";
- msg += "(higher means stronger alcohol): ";
- console.log(msg + val);
- }, 1000);
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq4.js b/peripheral/libupm/examples/javascript/mq4.js
deleted file mode 100644
index c8d589e..0000000
--- a/peripheral/libupm/examples/javascript/mq4.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmGAS = require("jsupm_gas");
-
-// Attach gas sensor to Analog A0
-var sensor = new upmGAS.MQ4(0);
-
-var threshContext = new upmGAS.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 microseconds;
-// find the average of 128 samples; and
-// print a running graph of asteriskss as averages
-
-while(1)
-{
- var buffer = new upmGAS.uint16Array(128);
- var len = sensor.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = sensor.findThreshold(threshContext, 30, buffer, len);
- sensor.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq5.js b/peripheral/libupm/examples/javascript/mq5.js
deleted file mode 100644
index db0a4cb..0000000
--- a/peripheral/libupm/examples/javascript/mq5.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmMQ5 = require("jsupm_gas");
-
-// Attach gas sensor to AIO0
-var myMQ5 = new upmMQ5.MQ5(0);
-
-var threshContext = new upmMQ5.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-while(1)
-{
- var buffer = new upmMQ5.uint16Array(128);
- var len = myMQ5.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = myMQ5.findThreshold(threshContext, 30, buffer, len);
- myMQ5.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq6.js b/peripheral/libupm/examples/javascript/mq6.js
deleted file mode 100644
index 03757a6..0000000
--- a/peripheral/libupm/examples/javascript/mq6.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmGAS = require("jsupm_gas");
-
-// Attach gas sensor to Analog A0
-var sensor = new upmGAS.MQ6(0);
-
-var threshContext = new upmGAS.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 microseconds;
-// find the average of 128 samples; and
-// print a running graph of asteriskss as averages
-
-while(1)
-{
- var buffer = new upmGAS.uint16Array(128);
- var len = sensor.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = sensor.findThreshold(threshContext, 30, buffer, len);
- sensor.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq7.js b/peripheral/libupm/examples/javascript/mq7.js
deleted file mode 100644
index 6d305b1..0000000
--- a/peripheral/libupm/examples/javascript/mq7.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmGAS = require("jsupm_gas");
-
-// Attach gas sensor to Analog A0
-var sensor = new upmGAS.MQ7(0);
-
-var threshContext = new upmGAS.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 microseconds;
-// find the average of 128 samples; and
-// print a running graph of asteriskss as averages
-
-while(1)
-{
- var buffer = new upmGAS.uint16Array(128);
- var len = sensor.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = sensor.findThreshold(threshContext, 30, buffer, len);
- sensor.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq8.js b/peripheral/libupm/examples/javascript/mq8.js
deleted file mode 100644
index 7b6bf99..0000000
--- a/peripheral/libupm/examples/javascript/mq8.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmGAS = require("jsupm_gas");
-
-// Attach gas sensor to Analog A0
-var sensor = new upmGAS.MQ8(0);
-
-var threshContext = new upmGAS.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-// Repeatedly, take a sample every 2 microseconds;
-// find the average of 128 samples; and
-// print a running graph of asteriskss as averages
-
-while(1)
-{
- var buffer = new upmGAS.uint16Array(128);
- var len = sensor.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = sensor.findThreshold(threshContext, 30, buffer, len);
- sensor.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/mq9.js b/peripheral/libupm/examples/javascript/mq9.js
deleted file mode 100644
index e89ddcc..0000000
--- a/peripheral/libupm/examples/javascript/mq9.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var upmMQ9 = require("jsupm_gas");
-
-// Attach gas sensor to AIO0
-var myMQ9 = new upmMQ9.MQ9(0);
-
-var threshContext = new upmMQ9.thresholdContext;
-threshContext.averageReading = 0;
-threshContext.runningAverage = 0;
-threshContext.averagedOver = 2;
-
-// Infinite loop, ends when script is cancelled
-while(1)
-{
- var buffer = new upmMQ9.uint16Array(128);
- var len = myMQ9.getSampledWindow(2, 128, buffer);
- if (len)
- {
- var thresh = myMQ9.findThreshold(threshContext, 30, buffer, len);
- myMQ9.printGraph(threshContext, 5);
- //if (thresh)
- // console.log("Threshold is " + thresh);
- }
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/nlgpio16.js b/peripheral/libupm/examples/javascript/nlgpio16.js
deleted file mode 100644
index 1a7e7c2..0000000
--- a/peripheral/libupm/examples/javascript/nlgpio16.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_nlgpio16');
-
-// Instantiate a NLGPIO16 Module on the default UART (/dev/ttyACM0)
-var sensor = new sensorObj.NLGPIO16();
-
-// get the Version
-console.log("Device Version:", sensor.getVersion());
-// read the gpio at pin 3
-console.log("GPIO 3 Value:", sensor.gpioRead(3));
-// read the analog voltage at pin 5
-console.log("Analog 5 Voltage:", sensor.analogReadVolts(5));
-// set the gpio at pin 14 to HIGH
-sensor.gpioSet(14);
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/nunchuck.js b/peripheral/libupm/examples/javascript/nunchuck.js
deleted file mode 100644
index c35a12a..0000000
--- a/peripheral/libupm/examples/javascript/nunchuck.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var nunchuck_lib = require('jsupm_nunchuck');
-
-// Instantiate a nunchuck controller bus 0
-var nunchuck_obj = new nunchuck_lib.NUNCHUCK(0);
-
-// always do this first
-console.log("Initializing... ");
-if (!nunchuck_obj.init())
-{
- console.log("nunchuck->init() failed.");
- process.exit(0);
-}
-
-setInterval(function()
-{
- nunchuck_obj.update();
-
- var outputStr = "stickX: " + nunchuck_obj.stickX +
- ", stickY: " + nunchuck_obj.stickY;
- console.log(outputStr);
- outputStr = "accelX: " + nunchuck_obj.accelX +
- ", accelY: " + nunchuck_obj.accelY +
- ", accelZ: " + nunchuck_obj.accelZ;
- console.log(outputStr);
-
- outputStr = "button C: " +
- ((nunchuck_obj.buttonC) ? "pressed" : "not pressed");
- console.log(outputStr);
- outputStr = "button Z: " +
- ((nunchuck_obj.buttonZ) ? "pressed" : "not pressed");
- console.log(outputStr);
-}, 100);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/oled_ssd1306.js b/peripheral/libupm/examples/javascript/oled_ssd1306.js
deleted file mode 100644
index b3ceac7..0000000
--- a/peripheral/libupm/examples/javascript/oled_ssd1306.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Author: Marc Graham <marc@m2ag.net>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-
-var intel_logo = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224,
-224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, 60,
-62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31,
-30, 62, 62, 62, 62, 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240,
-224, 224, 224, 192, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
-128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, 1, 1, 1, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195,
-195, 7, 15, 15, 63, 127, 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 192, 192, 240, 248, 124, 124, 60, 0, 0, 0, 0, 159, 159,
-159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128,
-128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0,
-0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
-128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128,
-128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
-0, 0, 0, 0, 3, 7, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 224, 248, 252, 252, 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, 255, 255,
-255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
-15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143,
-135, 135, 143, 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255,
-255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
-224, 248, 248, 255, 255, 255, 255, 255, 127, 15, 255, 255, 255, 255, 255,
-255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255,
-255, 255, 255, 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231,
-231, 231, 199, 135, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0,
-0, 0, 224, 240, 248, 248, 252, 254, 255, 255, 255, 127, 63, 63, 31, 15, 7,
-7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, 240, 192, 192, 128, 0, 0, 0,
-0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
-0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, 7, 7,
-7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7,
-7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7,
-7, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15,
-31, 127, 127, 127, 255, 255, 252, 252, 252, 248, 240, 240, 240, 224, 224,
-224, 192, 192, 192, 192, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192,
-224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, 252,
-254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-3, 3, 3, 7, 7, 7, 15, 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127,
-127, 127, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127,
-63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, 3, 3,
-3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0];
-
-function exit()
-{
- lcd = null;
- lcdObj.cleanUp();
- lcdObj = null;
- process.exit(0);
-}
-
-// Load i2clcd module
-var lcdObj = require('jsupm_i2clcd');
-var lcd = new lcdObj.SSD1306(6, 0x3c);
-var next = 0;
-
-lcd.clear();
-lcd.setCursor(2, 0);
-lcd.write("Hello");
-lcd.setCursor(3, 0);
-lcd.write("World!");
-
-setInterval(function(){
- loop();
-},
-3000 );
-
-function loop(){
- switch(next)
- {
- case 0:
- lcd.invert(true)
- break;
- case 1:
- lcd.dim(true);
- break;
- case 2:
- lcd.invert(false);
- break;
- case 3:
- lcd.startscrollright(0x00, 0x0F);
- break;
- case 4:
- lcd.startscrollleft(0x00, 0x0F);
- break;
- case 5:
- lcd.startscrolldiagleft(0x00, 0x0F)
- break;
- case 6:
- lcd.startscrolldiagright(0x00, 0x0F)
- break;
- case 7:
- var logo = new lcdObj.uint8Array(intel_logo.length);
- for(var x = 0 ; x < intel_logo.length ; x++){
- logo.setitem(x, intel_logo[x]);
- }
- lcd.stopscroll();
- lcd.clear();
- lcd.draw(logo, 1024);
- break;
- case 8:
- default:
- lcd.stopscroll();
- lcd.clear();
- lcd.setCursor(2, 0);
- lcd.write("All");
- lcd.setCursor(3, 0);
- lcd.write("Done!");
- exit();
- }
- next++;
-}
diff --git a/peripheral/libupm/examples/javascript/oled_ssd1308.js b/peripheral/libupm/examples/javascript/oled_ssd1308.js
deleted file mode 100644
index 280294b..0000000
--- a/peripheral/libupm/examples/javascript/oled_ssd1308.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load i2clcd module
-var LCD = require('jsupm_i2clcd');
-
-var myLcd = new LCD.SSD1308 (0, 0x3C);
-
-var logoArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224,
-224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, 60,
-62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31,
-30, 62, 62, 62, 62, 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240,
-224, 224, 224, 192, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
-128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, 1, 1, 1, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195,
-195, 7, 15, 15, 63, 127, 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 192, 192, 240, 248, 124, 124, 60, 0, 0, 0, 0, 159, 159,
-159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128,
-128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0,
-0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
-128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128,
-128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
-0, 0, 0, 0, 3, 7, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 224, 248, 252, 252, 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, 255, 255,
-255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
-15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143,
-135, 135, 143, 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255,
-255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
-224, 248, 248, 255, 255, 255, 255, 255, 127, 15, 255, 255, 255, 255, 255,
-255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255,
-255, 255, 255, 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231,
-231, 231, 199, 135, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0,
-0, 0, 224, 240, 248, 248, 252, 254, 255, 255, 255, 127, 63, 63, 31, 15, 7,
-7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, 240, 192, 192, 128, 0, 0, 0,
-0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
-0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, 7, 7,
-7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7,
-7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7,
-7, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15,
-31, 127, 127, 127, 255, 255, 252, 252, 252, 248, 240, 240, 240, 224, 224,
-224, 192, 192, 192, 192, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192,
-224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, 252,
-254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-3, 3, 3, 7, 7, 7, 15, 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127,
-127, 127, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127,
-63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, 3, 3,
-3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0];
-
-var intelLogo = new LCD.uint8Array(logoArr.length);
-for (var x = 0; x < logoArr.length; x++)
- intelLogo.setitem(x, logoArr[x]);
-
-myLcd.clear();
-myLcd.draw(intelLogo, 1024);
-
-intelLogo = null;
-myLcd = null;
-LCD.cleanUp();
-LCD = null;
diff --git a/peripheral/libupm/examples/javascript/oled_ssd1327.js b/peripheral/libupm/examples/javascript/oled_ssd1327.js
deleted file mode 100644
index 2832ad2..0000000
--- a/peripheral/libupm/examples/javascript/oled_ssd1327.js
+++ /dev/null
@@ -1,194 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-//Load i2clcd module
-var LCD = require('jsupm_i2clcd');
-
-var myLcd = new LCD.SSD1327 (0, 0x3C);
-
-var logoArr = [0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x07, 0x80, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xC0,
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
-0x07, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x20, 0x0F, 0x80, 0x01, 0xE0,
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
-0x0F, 0x00, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
-0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
-0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0,
-0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
-0x0F, 0x80, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x01, 0xE0,
-0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E,
-0x0F, 0x80, 0x03, 0xE0, 0x78, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1E, 0x07, 0x80, 0x03, 0xE0,
-0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
-0x07, 0x80, 0x03, 0xE0, 0xF0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1F, 0x07, 0x80, 0x03, 0xC1,
-0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
-0x87, 0xC0, 0x07, 0xC1, 0xF0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x0F, 0x83, 0xC0, 0x07, 0x83,
-0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
-0xC3, 0xC0, 0x07, 0x87, 0xE0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x07, 0xE1, 0xE0, 0x07, 0x0F,
-0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
-0xF0, 0xE0, 0x0F, 0x0F, 0x80, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0xF8, 0xF0, 0x0E, 0x1F,
-0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-0xF8, 0x70, 0x1C, 0x3F, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x18, 0x7E,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7F, 0x18, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1F, 0x88, 0x21, 0xF0,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0F, 0xC4, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x03, 0xE0, 0x0F, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xF8, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
-0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x6C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06,
-0x00, 0x00, 0x60, 0x00, 0x7E, 0x3F, 0x0F, 0xC3,
-0xF0, 0xFA, 0x0F, 0xDF, 0xE1, 0x9F, 0xEC, 0x7E,
-0xE6, 0x73, 0x9C, 0xE7, 0x39, 0xCE, 0x1C, 0xDF,
-0xE1, 0xB9, 0xEC, 0xE7, 0xE0, 0x61, 0xD8, 0x66,
-0x1B, 0x86, 0x1C, 0x06, 0x61, 0xB0, 0x6D, 0xC3,
-0x7C, 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x0F, 0x86,
-0x61, 0xB0, 0x6D, 0x83, 0x3E, 0x7F, 0xFF, 0xFF,
-0xFF, 0x06, 0x07, 0xC6, 0x61, 0xB0, 0x6D, 0x83,
-0xC3, 0x61, 0x18, 0x46, 0x03, 0x86, 0x18, 0x66,
-0x61, 0xB0, 0x6D, 0xC3, 0xFE, 0x7F, 0x9F, 0xE7,
-0xF9, 0xFE, 0x1F, 0xE6, 0x3F, 0x9F, 0xEC, 0xFE,
-0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xC6,
-0x3F, 0x9F, 0xEC, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00,
-0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x44, 0x00, 0x00, 0x20, 0x82, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0xF3,
-0xCF, 0x70, 0x9E, 0x79, 0xE7, 0x80, 0x00, 0x00,
-0x00, 0x00, 0x7D, 0x9E, 0x68, 0x20, 0xB2, 0xC8,
-0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9E,
-0x6F, 0x20, 0xB2, 0xF9, 0xE7, 0x80, 0x00, 0x00,
-0x00, 0x00, 0x46, 0x9A, 0x61, 0x20, 0xB2, 0xCB,
-0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xF3,
-0xCF, 0x30, 0x9E, 0x79, 0xE7, 0x90, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7C, 0x02, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00,
-0xF8, 0x00, 0x00, 0x40, 0x40, 0x02, 0x00, 0x00,
-0x83, 0x60, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x40,
-0x60, 0xB7, 0x79, 0xE7, 0x81, 0xC7, 0x92, 0x70,
-0x89, 0xE7, 0x9E, 0x78, 0x7C, 0xE2, 0xC9, 0x2C,
-0x81, 0xCC, 0xD2, 0x40, 0xFB, 0x21, 0xB2, 0x48,
-0x40, 0x62, 0xF9, 0x2C, 0x80, 0x8C, 0xD2, 0x40,
-0x8B, 0xE7, 0xB0, 0x48, 0x40, 0xE2, 0xC9, 0x2C,
-0x80, 0x84, 0xD2, 0x40, 0x8B, 0x2D, 0x92, 0x48,
-0x7D, 0xB3, 0x79, 0x27, 0x80, 0x87, 0x9E, 0x40,
-0x8D, 0xE7, 0x9E, 0x48, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
-
-var SeeedLogo = new LCD.uint8Array(logoArr.length);
-for (var x = 0; x < logoArr.length; x++)
- SeeedLogo.setitem(x, logoArr[x]);
-
-// If you don't set the display to be white, the seeed logo will appear jagged
-myLcd.setGrayLevel(12);
-myLcd.draw(SeeedLogo, 96 * 96 / 8);
-
-
-for (var i = 0; i < 12; i++)
-{
- myLcd.setCursor(i, 0);
- myLcd.setGrayLevel(i);
- myLcd.write('Hello World');
-}
-
-
diff --git a/peripheral/libupm/examples/javascript/otp538u.js b/peripheral/libupm/examples/javascript/otp538u.js
deleted file mode 100644
index 7da6853..0000000
--- a/peripheral/libupm/examples/javascript/otp538u.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// analog voltage, usually 3.3 or 5.0
-var OTP538U_AREF = 5.0;
-
-var tempIRSensor_lib = require('jsupm_otp538u');
-
-// Instantiate a OTP538U on analog pins A0 and A1
-// A0 is used for the Ambient Temperature and A1 is used for the
-// Object temperature.
-var tempIRSensor_obj = new tempIRSensor_lib.OTP538U(0, 1, OTP538U_AREF);
-
-
-function checkTemp()
-{
- var outputStr = "Ambient temp: " +
- roundNum(tempIRSensor_obj.ambientTemperature(), 2) +
- " C, Object temp: " +
- roundNum(tempIRSensor_obj.objectTemperature(), 2) +
- " C";
- console.log(outputStr);
-}
-
-var myInterval = setInterval(checkTemp, 1000);
-
-function roundNum(num, decimalPlaces)
-{
- var extraNum = (1 / (Math.pow(10, decimalPlaces) * 1000));
- return (Math.round((num + extraNum) *
- (Math.pow(10, decimalPlaces))) / Math.pow(10, decimalPlaces));
-}
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/ozw.js b/peripheral/libupm/examples/javascript/ozw.js
deleted file mode 100644
index 5c5c7d5..0000000
--- a/peripheral/libupm/examples/javascript/ozw.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_ozw');
-
-
-/************** Main code **************/
-// Instantiate an OZW instance
-var sensor = new sensorObj.OZW();
-
-var defaultDev = "/dev/ttyACM0";
-
-// if an argument was specified, use it as the device instead
-if (process.argv.length > 2)
-{
- defaultDev = process.argv[2];
-}
-
-// The first thing to do is create options, then lock them when done.
-sensor.optionsCreate();
-sensor.optionsLock();
-
-// Next, initialize it.
-console.log("Initializing, this may take awhile depending on your ZWave network");
-
-if (!sensor.init(defaultDev))
-{
- console.log("Init failed.");
- process.exit(0);
-}
-console.log("Initialization complete");
-
-console.log("Dumping nodes...");
-
-sensor.dumpNodes();
-
-// The following is example output of dumpNodes:
-//
-// Dumping nodes...
-// Node 1: Z-Stick Gen5
-// Node 2: Smart Switch 6
-// Index: 0, Type: bool, Label: Switch, Value: False
-// Index: 2, Type: float, Label: Energy, Value: 1.190 kWh
-// Index: 3, Type: float, Label: Previous Reading, Value: 1.190 kWh
-// Index: 4, Type: int32, Label: Interval, Value: 1521 seconds
-// Index: 5, Type: float, Label: Power, Value: 0.000 W
-// Index: 6, Type: float, Label: Voltage, Value: 121.256 V
-// Index: 7, Type: float, Label: Current, Value: 0.000 A
-// Index: 8, Type: bool, Label: Exporting, Value: False
-// Index: 45, Type: list, Label: Day, Value: Friday
-// Index: 46, Type: byte, Label: Hour, Value: 5
-// Index: 47, Type: byte, Label: Minute, Value: 53
-// Node 3: Multi Sensor
-// Index: 0, Type: bool, Label: Sensor, Value: True
-// Index: 1, Type: float, Label: Temperature, Value: 72.8 F
-// Index: 2, Type: float, Label: Luminance, Value: 4 lux
-// Index: 3, Type: float, Label: Relative Humidity, Value: 22 %
-// Index: 17, Type: byte, Label: Battery Level, Value: 98 %
-// Node 5: Minimote
-// Node 6: Smart Energy Switch
-// Index: 0, Type: bool, Label: Switch, Value: False
-// Index: 2, Type: float, Label: Power, Value: 0.000 W
-// Index: 3, Type: float, Label: Energy, Value: 1.609 kWh
-// Index: 4, Type: float, Label: Previous Reading, Value: 1.609 kWh
-// Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
-// Index: 6, Type: float, Label: Power, Value: 0.000 W
-// Index: 7, Type: float, Label: Previous Reading, Value: 1.609 W
-// Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
-// Index: 9, Type: bool, Label: Exporting, Value: False
-// Node 7: Smart Energy Switch
-// Index: 0, Type: bool, Label: Switch, Value: False
-// Index: 2, Type: float, Label: Power, Value: 0.000 W
-// Index: 3, Type: float, Label: Energy, Value: 0.000 kWh
-// Index: 4, Type: float, Label: Previous Reading, Value: 0.000 kWh
-// Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
-// Index: 6, Type: float, Label: Power, Value: 0.000 W
-// Index: 7, Type: float, Label: Previous Reading, Value: 0.000 W
-// Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
-// Index: 9, Type: bool, Label: Exporting, Value: False
-//
-// So, with the above in mind:
-//
-// 1. Query the temperature on node 3 and print it out (as a
-// string), along with the units of measure:
-//
-// console.log("Temperature: " + sensor.getValueAsString(3, 1) +
-// " " + sensor.getValueUnits(3, 1));
-//
-// 2. query the same temperature as a float:
-//
-// var temperature = sensor.getValueAsFloat(3, 1);
-//
-// 3. Turn on the light plugged into the switch on Node 7
-//
-// console.log("Turning ON node 7");
-// sensor.setValueAsBool(7, 0, true);
-//
-
-sensor = null;
-sensorObj.cleanUp();
-sensorObj = null;
-console.log("Exiting...");
-process.exit(0);
diff --git a/peripheral/libupm/examples/javascript/pca9685.js b/peripheral/libupm/examples/javascript/pca9685.js
deleted file mode 100644
index 3768f8e..0000000
--- a/peripheral/libupm/examples/javascript/pca9685.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-function exit()
-{
- console.log("Exiting");
-
- if (myLEDController_obj)
- {
- // clear the bits we set earlier
- myLEDController_obj.ledFullOff(3, false);
- myLEDController_obj.ledFullOn(4, false);
- }
- myLEDController_obj = null;
- if (LEDController_lib)
- {
- LEDController_lib.cleanUp();
- LEDController_lib = null;
- }
- process.exit(0);
-}
-
-// The pca9685 is an led controller.
-// It's being used in this case to drive motors.
-var LEDController_lib = require('jsupm_pca9685');
-
-var I2CBus = LEDController_lib.PCA9685_I2C_BUS;
-var I2CAddr = LEDController_lib.PCA9685_DEFAULT_I2C_ADDR;
-// Instantiate an PCA9685 on I2C bus 0
-var myLEDController_obj = new LEDController_lib.PCA9685(I2CBus, I2CAddr);
-
-// put device to sleep
-myLEDController_obj.setModeSleep(true);
-
-// setup a period of 50Hz
-myLEDController_obj.setPrescaleFromHz(50);
-
-// wake device up
-myLEDController_obj.setModeSleep(false);
-
-// Setup a 50% duty cycle -- on time at 0, off time at 2048 (4096 / 2)
-// Set for all channels
-var LEDNum = LEDController_lib.PCA9685_ALL_LED;
-myLEDController_obj.ledOnTime(LEDNum, 0);
-myLEDController_obj.ledOffTime(LEDNum, 2048);
-
-// but, turn channel 3 full off and channel 4 full on
-console.log("Turning channel 3 off, and channel 4 on.");
-console.log("All other channels will be PWM'd at a 50% duty cycle.");
-
-myLEDController_obj.ledFullOff(3, true);
-myLEDController_obj.ledFullOn(4, true);
-
- // now, just sleep for 5 seconds, reset channels 3 and 4, and exit.
-console.log("Sleeping for 5 seconds...");
-
-setTimeout(exit, 5000);
-
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/pn532-writeurl.js b/peripheral/libupm/examples/javascript/pn532-writeurl.js
deleted file mode 100644
index 2a037ad..0000000
--- a/peripheral/libupm/examples/javascript/pn532-writeurl.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Jon Trulson <jtrulson@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load PN532 module
-var pn532 = require('jsupm_pn532');
-
-// Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
-// IRQ, and gpio 2 for the reset pin.
-var myNFCObj = new pn532.PN532(3, 2);
-
-function writeUrl()
-{
- if (uidSize.getitem(0) != 7)
- {
- console.log("This example will only write an NDEF URI to preformatted");
- console.log("Mifare Ultralight or NTAG2XX tags");
- exit();
- }
-
- // 48 bytes is maximum data area on ultralight cards, so we use that
- // as the maximum datasize here. Obviously if you have a bigger
- // card, you can write more data.
- if (!myNFCObj.ntag2xx_WriteNDEFURI(pn532.PN532.NDEF_URIPREFIX_HTTP,
- url, 48))
- {
- // failure
- console.log("Failed to write NDEF record tag.");
- exit(1);
- }
-
- console.log("Success, URL record written to tag.");
-}
-
-function toHex(d, pad)
-{
- // pad should be between 1 and 8
- return ("00000000"+(Number(d).toString(16))).slice(-pad)
-}
-
-function exit()
-{
- clearInterval(myInterval);
- myNFCObj = null;
- pn532.cleanUp();
- pn532 = null;
- console.log("Exiting");
- process.exit(0);
-}
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- exit();
-});
-
-// "main"
-if (!myNFCObj.init())
- console.log("init() failed");
-
-var vers = myNFCObj.getFirmwareVersion();
-
-if (vers)
- console.log("Got firmware version: " + toHex(vers, 8));
-else
-{
- console.log("Could not identify PN532");
- exit();
-}
-
-// Now scan and identify any cards that come in range (1 for now)
-
-// Retry forever
-myNFCObj.setPassiveActivationRetries(0xff);
-
-myNFCObj.SAMConfig();
-
-var uidSize = new pn532.uint8Array(0);
-var uid = new pn532.uint8Array(7);
-
-// the URL we want to add as an NDEF record
-// NOTE: this cannot exceed 34 characters.
-url = "iotdk.intel.com";
-
-var myInterval = setInterval(function()
-{
- for (var x = 0; x < 7; x++)
- uid.setitem(x, 0);
- if (myNFCObj.readPassiveTargetID(pn532.PN532.BAUD_MIFARE_ISO14443A,
- uid, uidSize, 2000))
- {
- // found a card
- console.log("Found a card: UID len " + uidSize.getitem(0));
- process.stdout.write("UID: ");
- for (var i = 0; i < uidSize.getitem(0); i++)
- {
- var byteVal = uid.getitem(i);
- process.stdout.write(toHex(byteVal, 2) + " ");
- }
- process.stdout.write("\n");
- console.log("SAK: " + toHex(myNFCObj.getSAK(), 2));
- console.log("ATQA: " + toHex(myNFCObj.getATQA(), 4));
- console.log(" ");
-
- // write the URL
- writeUrl();
- clearInterval(myInterval);
- return;
- }
- else
- console.log("Waiting for a card...");
-}, 1000);
-
diff --git a/peripheral/libupm/examples/javascript/pn532.js b/peripheral/libupm/examples/javascript/pn532.js
deleted file mode 100644
index e740a73..0000000
--- a/peripheral/libupm/examples/javascript/pn532.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load PN532 module
-var pn532 = require('jsupm_pn532');
-
-// Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
-// IRQ, and gpio 2 for the reset pin.
-var myNFCObj = new pn532.PN532(3, 2);
-
-if (!myNFCObj.init())
- console.log("init() failed");
-
-var vers = myNFCObj.getFirmwareVersion();
-
-if (vers)
- console.log("Got firmware version: " + toHex(vers, 8));
-else
-{
- console.log("Could not identify PN532");
- exit();
-}
-
-// Now scan and identify any cards that come in range (1 for now)
-
-// Retry forever
-myNFCObj.setPassiveActivationRetries(0xff);
-
-myNFCObj.SAMConfig();
-
-var uidSize = new pn532.uint8Array(0);
-var uid = new pn532.uint8Array(7);
-
-var myInterval = setInterval(function()
-{
- for (var x = 0; x < 7; x++)
- uid.setitem(x, 0);
- if (myNFCObj.readPassiveTargetID(pn532.PN532.BAUD_MIFARE_ISO14443A,
- uid, uidSize, 2000))
- {
- // found a card
- console.log("Found a card: UID len " + uidSize.getitem(0));
- process.stdout.write("UID: ");
- for (var i = 0; i < uidSize.getitem(0); i++)
- {
- var byteVal = uid.getitem(i);
- process.stdout.write(toHex(byteVal, 2) + " ");
- }
- process.stdout.write("\n");
- console.log("SAK: " + toHex(myNFCObj.getSAK(), 2));
- console.log("ATQA: " + toHex(myNFCObj.getATQA(), 4));
- console.log(" ");
- }
- else
- console.log("Waiting for a card...");
-}, 1000);
-
-function toHex(d, pad)
-{
- // pad should be between 1 and 8
- return ("00000000"+(Number(d).toString(16))).slice(-pad)
-}
-
-function exit()
-{
- clearInterval(myInterval);
- myNFCObj = null;
- pn532.cleanUp();
- pn532 = null;
- console.log("Exiting");
- process.exit(0);
-}
-
-// When exiting: clear interval, and print message
-process.on('SIGINT', function()
-{
- exit();
-});
diff --git a/peripheral/libupm/examples/javascript/ppd42ns.js b/peripheral/libupm/examples/javascript/ppd42ns.js
deleted file mode 100644
index c6a48da..0000000
--- a/peripheral/libupm/examples/javascript/ppd42ns.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Load dust sensor module
-var dustSensor = require('jsupm_ppd42ns');
-// Instantiate a dust sensor on digital pin D8
-var myDustSensor = new dustSensor.PPD42NS(8);
-
-var data;
-
-// Continue until user ends program
-var notice = "This program will give readings ";
-notice += "every 30 seconds until you stop it"
-console.log(notice);
-while(1)
-{
- data = myDustSensor.getData();
- console.log("Low pulse occupancy: " + data.lowPulseOccupancy);
- console.log("Ratio: " + data.ratio);
- console.log("Concentration: " + data.concentration);
-}
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/rfr359f.js b/peripheral/libupm/examples/javascript/rfr359f.js
deleted file mode 100644
index 00832a0..0000000
--- a/peripheral/libupm/examples/javascript/rfr359f.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var distInterrupter = require("jsupm_rfr359f");
-
-// Instantiate an RFR359F digital pin D2
-// This was tested on the Grove IR Distance Interrupter
-var myDistInterrupter = new distInterrupter.RFR359F(2);
-
-// The range appears to be about 4 inches, depending on adjustment
-var myInterval = setInterval(function()
-{
- if (myDistInterrupter.objectDetected())
- console.log("Object detected");
- else
- console.log("Area is clear");
-}, 100);
-
-// When exiting: turn off LED, clear interval, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/rgbringcoder.js b/peripheral/libupm/examples/javascript/rgbringcoder.js
deleted file mode 100644
index 6fb2276..0000000
--- a/peripheral/libupm/examples/javascript/rgbringcoder.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var ringcoderObj = require('jsupm_rgbringcoder');
-
-// There are a lot of pins to hook up. These pins are valid for the
-// Edison board, but may need to be adjusted for other platforms.
-
-// In order:
-// enable - 4
-// latch - 10
-// clear - 11
-// clock - 2
-// data - 9
-// switch - 7
-
-// red pwm - 3
-// green pwm - 5
-// blue pwm - 6
-
-// encA - 12
-// encB - 13
-var ringCoder = new ringcoderObj.RGBRingCoder(4, 10, 11, 2, 9, 7, 12, 13, 3,
- 5, 6);
-
-var spin = 0x0001;
-var oldState = false;
-var oldPos = 0;
-
-// Lets go green
-ringCoder.setRGBLED(0.99, 0.01, 0.99);
-
-setInterval(function()
-{
- // you spin me round...
- if ((spin & 0xffff) == 0)
- spin = 0x0001;
-
- ringCoder.setRingLEDS(spin);
- spin <<= 1;
-
- // check button state
- var bstate = ringCoder.getButtonState();
- if (bstate != oldState)
- {
- console.log("Button state changed from " + oldState + " to "
- + bstate);
- oldState = bstate;
- }
-
- // check encoder position
- var epos = ringCoder.getEncoderPosition();
- if (epos != oldPos)
- {
- console.log("Encoder position changed from " + oldPos + " to "
- + epos);
- oldPos = epos;
- }
-}, 100);
-
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- ringCoder = null;
- ringcoderObj.cleanUp();
- ringcoderObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
-
-
-
diff --git a/peripheral/libupm/examples/javascript/rhusb.js b/peripheral/libupm/examples/javascript/rhusb.js
deleted file mode 100644
index bbd5a16..0000000
--- a/peripheral/libupm/examples/javascript/rhusb.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_rhusb');
-
-
-/************** Main code **************/
-
-var defaultDev = "/dev/ttyUSB0";
-
-// if an argument was specified, use it as the device instead
-if (process.argv.length > 2)
-{
- defaultDev = process.argv[2];
-}
-
-console.log("Using device " + defaultDev);
-console.log("Initializing...");
-
-// Instantiate an RHUSB instance on defaultDev
-var sensor = new sensorObj.RHUSB(defaultDev);
-
-// output the firmware ID
-console.log("Firmware ID:", sensor.getFirmwareID());
-console.log("");
-
-// update and print available values every second
-setInterval(function()
-{
- // update our values from the sensor
- sensor.update();
-
- // we show both C and F for temperature
- console.log("Temperature:", sensor.getTemperature(),
- "C /", sensor.getTemperature(true), "F");
-
- console.log("Humidity:", sensor.getHumidity(), "%");
-
- console.log("");
-
-}, 1000);
-
-
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/rotaryencoder.js b/peripheral/libupm/examples/javascript/rotaryencoder.js
deleted file mode 100644
index a3f5d00..0000000
--- a/peripheral/libupm/examples/javascript/rotaryencoder.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var rotaryEncoder = require("jsupm_rotaryencoder");
-
-// Instantiate a Grove Rotary Encoder, using signal pins D2 and D3
-var myRotaryEncoder = new rotaryEncoder.RotaryEncoder(2, 3);
-
-var myInterval = setInterval(function()
-{
- console.log("Position: " + myRotaryEncoder.position());
-}, 100);
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/rpr220.js b/peripheral/libupm/examples/javascript/rpr220.js
deleted file mode 100644
index 5474bdd..0000000
--- a/peripheral/libupm/examples/javascript/rpr220.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var reflectiveSensor = require("jsupm_rpr220");
-
-// This example uses a simple method to determine current status
-
-// Instantiate an RPR220 digital pin D2
-// This was tested on the Grove IR Reflective Sensor
-var myReflectiveSensor = new reflectiveSensor.RPR220(2);
-
-var myInterval = setInterval(function()
-{
- if (myReflectiveSensor.blackDetected())
- console.log("Black detected");
- else
- console.log("Black NOT detected");
-}, 100);
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/sainsmartks.js b/peripheral/libupm/examples/javascript/sainsmartks.js
deleted file mode 100644
index f81168f..0000000
--- a/peripheral/libupm/examples/javascript/sainsmartks.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var sainsmartObj = require('jsupm_i2clcd');
-
-// Instantiate a Sainsmart LCD Keypad Shield using default pins
-var lcd = new sainsmartObj.SAINSMARTKS();
-
-lcd.setCursor(0,0);
-lcd.write("Sainsmart KS");
-lcd.setCursor(1,2);
-lcd.write("Hello World");
-
-// output current key value every second.
-setInterval(function()
-{
- console.log("Button value: " + lcd.getRawKeyValue());
-}, 1000);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- lcd = null;
- sainsmartObj.cleanUp();
- sainsmartObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/si114x.js b/peripheral/libupm/examples/javascript/si114x.js
deleted file mode 100644
index 94d438a..0000000
--- a/peripheral/libupm/examples/javascript/si114x.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var UV_lib = require('jsupm_si114x');
-
-// Instantiate a SI114x UV Sensor on I2C bus 0
-var myUVSensor = new UV_lib.SI114X(0);
-
-for (var x in myUVSensor)
- console.log(x);
-// First initialize it
-myUVSensor.initialize();
-
-console.log("UV Index Scale:");
-console.log("---------------");
-console.log("11+ Extreme");
-console.log("8-10 Very High");
-console.log("6-7 High");
-console.log("3-5 Moderate");
-console.log("0-2 Low\n");
-
-// update every second and print the currently measured UV Index
-var myInterval = setInterval(function()
-{
- // update current value(s)
- myUVSensor.update();
-
- // print detected value
- console.log("UV Index: " + myUVSensor.getUVIndex());
-}, 1000);
-
-
-// When exiting: clear interval and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myUVSensor = null
- UV_lib.cleanUp();
- UV_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/sm130.js b/peripheral/libupm/examples/javascript/sm130.js
deleted file mode 100644
index b0f86f8..0000000
--- a/peripheral/libupm/examples/javascript/sm130.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_sm130');
-
-// Instantiate a UART based SM130 RFID Module using defaults
-var sensor = new sensorObj.SM130();
-
-// Set the baud rate, 19200 baud is the default.
-if (sensor.setBaudRate(19200))
-{
- console.log("Failed to set baud rate");
- process.exit(0);
-}
-
-console.log("Resetting...");
-sensor.reset();
-
-console.log("Firmware revision: " + sensor.getFirmwareVersion());
-
-console.log("Waiting up to 5 seconds for a tag...");
-
-if (sensor.waitForTag(5000))
-{
- console.log("Found tag, UID: " +
- sensor.string2HexString(sensor.getUID()));
- console.log("Tag Type: " +
- sensor.tag2String(sensor.getTagType()));
-}
-else
-{
- // error
- console.log("waitForTag failed: " +
- sensor.getLastErrorString());
-}
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/st7735.js b/peripheral/libupm/examples/javascript/st7735.js
deleted file mode 100644
index 3718c5d..0000000
--- a/peripheral/libupm/examples/javascript/st7735.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Takahiro Poly Horikawa <horikawa.takahiro@gmail.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var st7735 = require('jsupm_st7735');
-
-var lcd = new st7735.ST7735(10, 7, 9, 8);
-lcd.fillScreen(st7735.ST7735_RED);
-lcd.refresh();
-
-lcd.fillScreen(st7735.ST7735_CYAN);
-lcd.refresh();
-
-lcd.fillScreen(st7735.ST7735_BLACK);
-lcd.refresh();
-
-lcd.drawLine(10, 10, 10, 100, st7735.ST7735_MAGENTA);
-lcd.drawLine(20, 20, 10, 100, st7735.ST7735_YELLOW);
-lcd.drawLine(30, 30, 10, 100, st7735.ST7735_WHITE);
-lcd.refresh();
-
-lcd.drawPixel(20, 20, st7735.ST7735_GREEN);
-lcd.refresh();
-
-lcd.drawTriangle(50, 50, 80, 80, 60, 90, st7735.ST7735_GREEN);
-lcd.refresh();
-
-lcd.drawCircle(100, 110, 10, st7735.ST7735_BLUE);
-lcd.refresh();
-
-lcd.setTextWrap(0x0);
-
-lcd.setCursor(0, 30);
-lcd.setTextColor(st7735.ST7735_RED, st7735.ST7735_RED);
-lcd.setTextSize(1);
-lcd.print('Hello World!');
-
-lcd.setCursor(10, 50);
-lcd.setTextColor(st7735.ST7735_RED, st7735.ST7735_RED);
-lcd.setTextSize(2);
-lcd.print('BIG');
-
-lcd.refresh();
-
diff --git a/peripheral/libupm/examples/javascript/stepmotor.js b/peripheral/libupm/examples/javascript/stepmotor.js
deleted file mode 100644
index 51842a5..0000000
--- a/peripheral/libupm/examples/javascript/stepmotor.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var lib = require('jsupm_stepmotor');
-
-// Instantiate a stepper motor driver on pins 2 (direction) and 3 (step)
-var stepper = new lib.StepMotor(2, 3);
-
-function delay(milliseconds) {
- var startTime = Date.now();
- while (Date.now() - startTime < milliseconds);
-}
-
-stepper.quit = function()
-{
- stepper = null;
- lib.cleanUp();
- lib = null;
- console.log("Exiting");
- process.exit(0);
-};
-
-// The driver is synchronous and blocking
-console.log("Rotating 1 revolution forward and back at 60 rpm.");
-stepper.setSpeed(60);
-stepper.stepForward(200);
-delay(1000);
-stepper.stepBackward(200);
-delay(1000);
-
-console.log("Rotating 1 revolution forward and back at 150 rpm.");
-stepper.setSpeed(150);
-stepper.stepForward(200);
-delay(1000);
-stepper.stepBackward(200);
-delay(1000);
-
-console.log("Rotating 1 revolution forward and back at 300 rpm.");
-stepper.setSpeed(300);
-stepper.stepForward(200);
-delay(1000);
-stepper.stepBackward(200);
-delay(1000);
-
-stepper.quit();
diff --git a/peripheral/libupm/examples/javascript/sx1276-fsk.js b/peripheral/libupm/examples/javascript/sx1276-fsk.js
deleted file mode 100644
index c3a4b3a..0000000
--- a/peripheral/libupm/examples/javascript/sx1276-fsk.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_sx1276');
-
-var count = 0;
-var interval;
-
-/************** Functions **************/
-function transmit(sensor)
-{
- var buffer = "Ping " + count;
- count++;
- console.log("Sending... " + buffer);
-
- sensor.sendStr(buffer, 3000);
- sensor.setSleep();
-}
-
-function receive(sensor)
-{
- console.log("Attempting to receive... ");
- var rv = 0;
- rv = sensor.setRx(3000);
-
- if (rv)
- {
- console.log("setRx returned " + rv);
- }
- else
- {
- console.log("Received Buffer: " + sensor.getRxBufferStr());
- }
-
- sensor.setSleep();
-}
-
-/************** Main code **************/
-// Instantiate an SX1276 using default parameters
-
-var sensor = new sensorObj.SX1276();
-
-console.log("Specify an argument to go into receive mode. Default is transmit");
-
-// 915Mhz
-sensor.setChannel(915000000)
-
-// FSK configuration (rx and tx must be configured the same):
-// Tx output power = 14 dBm
-// FSK freq deviation = 25000 Hz
-// FSK bandwidth = 50000 bps
-// FSK AFC bandwidth = 83333 Hz
-// FSK datarate = 50000 bps
-// FSK preamble len = 5
-// FSK fixed length payload = false
-// FSK CRC check = true
-// FSK (rx) continuous Rx mode = False
-
-sensor.setTxConfig(sensorObj.SX1276.MODEM_FSK, 14, 25000, 0,
- 50000, 0, 5, false, true, false, 0, false);
-
-sensor.setRxConfig(sensorObj.SX1276.MODEM_FSK, 50000, 50000,
- 0, 83333, 5, 0, false, 0, true,
- false, 0, false, true);
-
-
-if (process.argv.length > 2)
-{
- // receive mode
- interval = setInterval(function() { receive(sensor); }, 250);
-}
-else
-{
- // transmit mode
- interval = setInterval(function() { transmit(sensor); }, 1000);
-}
-
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/sx1276-lora.js b/peripheral/libupm/examples/javascript/sx1276-lora.js
deleted file mode 100644
index 82581cc..0000000
--- a/peripheral/libupm/examples/javascript/sx1276-lora.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_sx1276');
-
-var count = 0;
-var interval;
-
-/************** Functions **************/
-function transmit(sensor)
-{
- var buffer = "Ping " + count;
- count++;
- console.log("Sending... " + buffer);
-
- sensor.sendStr(buffer, 3000);
- sensor.setSleep();
-}
-
-function receive(sensor)
-{
- console.log("Attempting to receive... ");
- var rv = 0;
- rv = sensor.setRx(3000);
-
- if (rv)
- {
- console.log("setRx returned " + rv);
- }
- else
- {
- console.log("Received Buffer: " + sensor.getRxBufferStr());
- }
-
- sensor.setSleep();
-}
-
-/************** Main code **************/
-// Instantiate an SX1276 using default parameters
-
-var sensor = new sensorObj.SX1276();
-
-console.log("Specify an argument to go into receive mode. Default is transmit");
-
-// 915Mhz
-sensor.setChannel(915000000)
-
-// LORA configuration (rx and tx must be configured the same):
-// Tx output power = 14 dBm
-// LORA bandwidth = 125000 (can also be 250K and 500K)
-// LORA spreading factor = 7
-// LORA coding rate = 1 (4/5)
-// LORA preamble len = 8
-// LORA symbol timeout = 5
-// LORA fixed payload = false
-// LORA IQ inversion = false
-// LORA (rx) continuous Rx mode = true
-
-sensor.setTxConfig(sensorObj.SX1276.MODEM_LORA, 14, 0, 125000,
- 7, 1, 8, false, true, false, 0, false);
-
-sensor.setRxConfig(sensorObj.SX1276.MODEM_LORA, 125000, 7,
- 1, 0, 8, 5, false, 0, true, false, 0, false, true);
-
-if (process.argv.length > 2)
-{
- // receive mode
- interval = setInterval(function() { receive(sensor); }, 250);
-}
-else
-{
- // transmit mode
- interval = setInterval(function() { transmit(sensor); }, 1000);
-}
-
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/sx6119.js b/peripheral/libupm/examples/javascript/sx6119.js
deleted file mode 100644
index 6833fc0..0000000
--- a/peripheral/libupm/examples/javascript/sx6119.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var FM_receiver_lib = require('jsupm_sx6119');
-
-// Instantiate a SX6119 on digital pins 2 (power) and 3 (seek)
-// This example was tested on the Grove FM Receiver.
-var myFM_receiver_obj = new FM_receiver_lib.SX6119(2, 3);
-
-// if an argument was specified (any argument), seek to the next
-// station, else just toggle the power.
-
-
-console.log("Supply any argument to the command line to seek to the");
-console.log("next station.");
-console.log("Running the example without an argument will toggle the");
-console.log("power on or off.\n");
-
-var doSeek = false;
-
-if (process.argv.length > 2)
- doSeek = true;
-
-// depending on what was selected, do it
-if (doSeek)
- myFM_receiver_obj.seek();
-else
- myFM_receiver_obj.togglePower();
-
-console.log("Exiting");
diff --git a/peripheral/libupm/examples/javascript/t3311.js b/peripheral/libupm/examples/javascript/t3311.js
deleted file mode 100644
index e62679b..0000000
--- a/peripheral/libupm/examples/javascript/t3311.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_t3311');
-
-
-/************** Main code **************/
-
-var defaultDev = "/dev/ttyUSB0";
-
-// if an argument was specified, use it as the device instead
-if (process.argv.length > 2)
-{
- defaultDev = process.argv[2];
-}
-
-console.log("Initializing...");
-
-// Instantiate an T3311 instance, using MODBUS slave address 1, and
-// default comm parameters (9600, 8, N, 2)
-var sensor = new sensorObj.T3311(defaultDev, 1);
-
-// output the serial number and firmware revision
-console.log("Serial Number:", sensor.getSerialNumber());
-console.log("Firmware Revision:", sensor.getFirmwareMajor() + "." +
- sensor.getFirmwareMinor());
-console.log("");
-
-// update and print available values every second
-setInterval(function()
-{
- // update our values from the sensor
- sensor.update();
-
- // we show both C and F for temperature
- console.log("Temperature:", sensor.getTemperature(),
- "C /", sensor.getTemperature(true), "F");
-
- console.log("Humidity:", sensor.getHumidity(), "%");
-
- // this value depends on the sensor configuration -- by default
- // it is the dew point temperature
- console.log("Computed Value:", sensor.getComputedValue());
-
- // with FW revisions > 2.44, extended computed data is available
- if (sensor.extendedDataAvailable())
- {
- console.log("Dew Point Temperature:", sensor.getDewPointTemperature(),
- "C /", sensor.getDewPointTemperature(true), "F");
-
- console.log("Absolute Humidity:", sensor.getAbsoluteHumidity(),
- "g/m3");
-
- console.log("Specific Humidity:", sensor.getSpecificHumidity(),
- "g/kg");
-
- console.log("Mixing Ratio:", sensor.getMixingRatio(),
- "g/kg");
-
- console.log("Specific Enthalpy:", sensor.getSpecificEnthalpy(),
- "kJ/kg");
- }
-
- console.log("");
-
-}, 1000);
-
-
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/ta12200.js b/peripheral/libupm/examples/javascript/ta12200.js
deleted file mode 100644
index 57dafeb..0000000
--- a/peripheral/libupm/examples/javascript/ta12200.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var electricitySensor = require('jsupm_ta12200');
-// Instantiate a TA12-200 sensor on analog pin A0
-var myElectricitySensor = new electricitySensor.TA12200(0);
-
-var maxVal, current;
-var myInterval = setInterval(function()
-{
- maxVal = myElectricitySensor.highestValue();
- current = myElectricitySensor.milliAmps(maxVal);
-
- outputStr = "Max ADC Value: " + maxVal +
- ", current: " + current + "mA";
- console.log(outputStr);
-}, 100);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- myElectricitySensor = null;
- electricitySensor.cleanUp();
- electricitySensor = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/tcs3414cs.js b/peripheral/libupm/examples/javascript/tcs3414cs.js
deleted file mode 100644
index 6c1579c..0000000
--- a/peripheral/libupm/examples/javascript/tcs3414cs.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var colorSensor = require('jsupm_tcs3414cs');
-
-// Instantiate the color sensor on I2C
-var mycolorSensor = new colorSensor.TCS3414CS();
-
-var rgb = new colorSensor.tcs3414sc_rgb_t;
-
-// Print out the r, g, b, and clr value every 0.5 seconds
-setInterval(function()
-{
- mycolorSensor.readRGB(rgb);
- console.log(rgb.r + ", " + rgb.g + ", " + rgb.b + ", " + rgb.clr);
-}, 500);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/tm1637.js b/peripheral/libupm/examples/javascript/tm1637.js
deleted file mode 100644
index 6220059..0000000
--- a/peripheral/libupm/examples/javascript/tm1637.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Some vars
-var colon = true;
-var interval;
-
-// Load display
-var tm1637 = require('jsupm_tm1637');
-
-// Instantiate on pins 0 (Clk) and 1 (Dio)
-var display = new tm1637.TM1637(0, 1);
-
-// Get the current time
-var now = new Date();
-console.log("System time: " + now.getHours() + ":" + ("0" + now.getMinutes()).slice(-2));
-console.log("Time zone can be changed by setting the TZ environment variable.");
-
-// Display and time update function
-function update(){
- now = new Date();
- var time = now.getHours().toString() + ("0" + now.getMinutes().toString()).slice(-2);
- display.writeString(time);
- display.setColon(colon = !colon);
-}
-
-// Start with a 7-segment encoded box on the display
-display.write(0x39, 0x09, 0x09, 0x0f);
-
-// Start displaying the clock after 3 seconds
-setTimeout(function(){
- // And update every second thereafter
- interval = setInterval(update, 1000);
-}, 3000)
-
-// Exit handler
-process.on('SIGINT', function()
-{
- clearInterval(interval);
- display = null;
- tm1637.cleanUp();
- tm1637 = null;
- console.log("Interrupt received, exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/tp401.js b/peripheral/libupm/examples/javascript/tp401.js
deleted file mode 100644
index 6ab2b29..0000000
--- a/peripheral/libupm/examples/javascript/tp401.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-var upmTP401 = require('jsupm_gas');
-//var time = require('sleep');
-
-//give a qualitative meaning to the value from the sensor
-function airQuality(value)
-{
- if(value < 50) return "Fresh Air";
- if(value < 200) return "Normal Indoor Air";
- if(value < 400) return "Low Pollution";
- if(value < 600) return "High Pollution - Action Recommended";
- return "Very High Pollution - Take Action Immediately";
-}
-
-function loop()
-{
- //read values (consecutive reads might vary slightly)
- var value = airSensor.getSample();
- var ppm = airSensor.getPPM();
-
- //write the sensor values to the console
- console.log("raw: " + value + " ppm: " + (" " + ppm.toFixed(2)).substring(-5, 5) + " " + airQuality(value));
-
- //wait 2.5 s then call function again
- setTimeout(loop, 2500);
-}
-
-//setup sensor on Analog pin #0 (A0)
-var airSensor = new upmTP401.TP401(0);
-
-//warm up sensor
-console.log("Sensor is warming up for 3 minutes..");
-var i = 1;
-
-//print a message every passing minute
-var waiting = setInterval(function() {
- console.log(i++ + " minute(s) passed.");
- if(i == 3) clearInterval(waiting);
- }, 60000);
-
-//start loop in 3 minutes
-setTimeout(function(){
- console.log("Sensor is ready!");
- loop();
- }, 180000);
diff --git a/peripheral/libupm/examples/javascript/tsl2561.js b/peripheral/libupm/examples/javascript/tsl2561.js
deleted file mode 100644
index cd3d7ff..0000000
--- a/peripheral/libupm/examples/javascript/tsl2561.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var digitalLightSensor = require('jsupm_tsl2561');
-
-// Instantiate a digital light sensor TSL2561 on I2C
-var myDigitalLightSensor = new digitalLightSensor.TSL2561();
-
-
-setInterval(function()
-{
- console.log("Light value is " + myDigitalLightSensor.getLux());
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/ttp223.js b/peripheral/libupm/examples/javascript/ttp223.js
deleted file mode 100644
index 8814556..0000000
--- a/peripheral/libupm/examples/javascript/ttp223.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Sarah Knepper <sarah.knepper@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-// Load TTP223 touch sensor module
-var sensorModule = require('jsupm_ttp223');
-
-// Create the TTP223 touch sensor object using GPIO pin 0
-var touch = new sensorModule.TTP223(0);
-
-// Check whether or not a finger is near the touch sensor and
-// print accordingly, waiting one second between readings
-function readSensorValue() {
- if ( touch.isPressed() ) {
- console.log(touch.name() + " is pressed");
- } else {
- console.log(touch.name() + " is not pressed");
- }
-}
-setInterval(readSensorValue, 1000);
diff --git a/peripheral/libupm/examples/javascript/ublox6.js b/peripheral/libupm/examples/javascript/ublox6.js
deleted file mode 100644
index d68640a..0000000
--- a/peripheral/libupm/examples/javascript/ublox6.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var GPSSensor = require('jsupm_ublox6');
-
-// Instantiate a Ublox6 GPS device on uart 0.
-var myGPSSensor = new GPSSensor.Ublox6(0);
-
-if (!myGPSSensor.setupTty(GPSSensor.int_B9600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(0);
-}
-
-// Collect and output NMEA data.
-
-// This device also supports numerous configuration options, which
-// you can set with writeData(). Please refer to the Ublox-6 data
-// sheet for further information on the formats of the data sent and
-// received, and the various operating modes available.
-
-var bufferLength = 256;
-var nmeaBuffer = new GPSSensor.charArray(bufferLength);
-
-function getGPSInfo()
-{
- // we don't want the read to block in this example, so always
- // check to see if data is available first.
- if (myGPSSensor.dataAvailable())
- {
- var rv = myGPSSensor.readData(nmeaBuffer, bufferLength);
-
- var GPSData, dataCharCode, isNewLine, lastNewLine;
- var numlines= 0;
- if (rv > 0)
- {
- GPSData = "";
- // read only the number of characters
- // specified by myGPSSensor.readData
- for (var x = 0; x < rv; x++)
- GPSData += nmeaBuffer.getitem(x);
- process.stdout.write(GPSData)
- }
-
- if (rv < 0) // some sort of read error occured
- {
- console.log("Port read error.");
- process.exit(0);
- }
- }
-}
-
-setInterval(getGPSInfo, 100);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/uln200xa.js b/peripheral/libupm/examples/javascript/uln200xa.js
deleted file mode 100644
index 4101707..0000000
--- a/peripheral/libupm/examples/javascript/uln200xa.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Jon Trulson <jtrulson@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var Uln200xa_lib = require('jsupm_uln200xa');
-
-// Instantiate a Stepper motor on a ULN200XA Darlington Motor Driver
-// This was tested with the Grove Geared Step Motor with Driver
-
-// Instantiate a ULN2003XA stepper object
-var myUln200xa_obj = new Uln200xa_lib.ULN200XA(4096, 8, 9, 10, 11);
-
-myUln200xa_obj.goForward = function()
-{
- myUln200xa_obj.setSpeed(5); // 5 RPMs
- myUln200xa_obj.setDirection(Uln200xa_lib.ULN200XA.DIR_CW);
- console.log("Rotating 1 revolution clockwise.");
- myUln200xa_obj.stepperSteps(4096);
-};
-
-myUln200xa_obj.reverseDirection = function()
-{
- console.log("Rotating 1/2 revolution counter clockwise.");
- myUln200xa_obj.setDirection(Uln200xa_lib.ULN200XA.DIR_CCW);
- myUln200xa_obj.stepperSteps(2048);
-};
-
-myUln200xa_obj.stop = function()
-{
- myUln200xa_obj.release();
-};
-
-myUln200xa_obj.quit = function()
-{
- myUln200xa_obj = null;
- Uln200xa_lib.cleanUp();
- Uln200xa_lib = null;
- console.log("Exiting");
- process.exit(0);
-};
-
-// Run ULN200xa driven stepper
-myUln200xa_obj.goForward();
-setTimeout(myUln200xa_obj.reverseDirection, 2000);
-setTimeout(function()
-{
- myUln200xa_obj.stop();
- myUln200xa_obj.quit();
-}, 2000);
diff --git a/peripheral/libupm/examples/javascript/urm37-uart.js b/peripheral/libupm/examples/javascript/urm37-uart.js
deleted file mode 100644
index ee81cc5..0000000
--- a/peripheral/libupm/examples/javascript/urm37-uart.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_urm37');
-
-// Instantiate a URM37 sensor on UART 0, with the reset pin on D2
-var sensor = new sensorObj.URM37(0, 2);
-
-// Every half a second, sample the URM37 and output the measured
-// distance in cm, and temperature in degrees C
-
-setInterval(function()
-{
- console.log("Detected distance (cm): " + sensor.getDistance());
- console.log("Temperature (C): " + sensor.getTemperature());
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/urm37.js b/peripheral/libupm/examples/javascript/urm37.js
deleted file mode 100644
index 17b1c16..0000000
--- a/peripheral/libupm/examples/javascript/urm37.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_urm37');
-
-// Instantiate a URM37 sensor on analog pin A0, reset pin on D2,
-// trigger pin on D3 with an analog reference voltage of 5.0
-var sensor = new sensorObj.URM37(0, 2, 3, 5.0);
-
-// Every half a second, sample the URM37 and output the measured
-// distance in cm.
-
-setInterval(function()
-{
- console.log("Detected distance (cm): " + sensor.getDistance());
-}, 500);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/waterlevel.js b/peripheral/libupm/examples/javascript/waterlevel.js
deleted file mode 100644
index bb4d0af..0000000
--- a/peripheral/libupm/examples/javascript/waterlevel.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var waterlevel_lib = require("jsupm_waterlevel");
-
-// The was tested with the Water Level Sensor
-// Instantiate a Water Level Sensor on digital pin D2
-var waterlevel_obj = new waterlevel_lib.WaterLevel(2);
-
-var myInterval = setInterval(function()
-{
- if (waterlevel_obj.isSubmerged())
- console.log("Sensor is submerged in liquid");
- else
- console.log("Liquid is below water level sensor");
-}, 1000);
-
-// When exiting: clear interval, clean up memory, and print message
-process.on('SIGINT', function()
-{
- clearInterval(myInterval);
- waterlevel_obj = null;
- waterlevel_lib.cleanUp();
- waterlevel_lib = null;
- console.log("Exiting");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/wheelencoder.js b/peripheral/libupm/examples/javascript/wheelencoder.js
deleted file mode 100644
index 532ea02..0000000
--- a/peripheral/libupm/examples/javascript/wheelencoder.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_wheelencoder');
-
-// Instantiate a DFRobot Wheel Encoder on digital pin D2
-var sensor = new sensorObj.WheelEncoder(2);
-
-// set the counter to 0 and start counting
-sensor.clearCounter();
-sensor.startCounter();
-
-setInterval(function()
-{
- // output milliseconds passed and current sensor count
- console.log("Millis: " + sensor.getMillis() + " Count: " +
- sensor.counter());
-}, 1000);
-
-// exit on ^C
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting.");
- process.exit(0);
-});
-
diff --git a/peripheral/libupm/examples/javascript/wt5001.js b/peripheral/libupm/examples/javascript/wt5001.js
deleted file mode 100644
index ca58b04..0000000
--- a/peripheral/libupm/examples/javascript/wt5001.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var MP3Player = require('jsupm_wt5001');
-
-function printUsage(progname)
-{
- console.log("Usage: node " + progname + " <command>");
- console.log("Commands:");
- console.log("0 - stop playing");
- console.log("1 - start playing track 1");
- console.log("2 - pause/un-pause playback");
- console.log("3 - next track");
- console.log("4 - previous track");
-}
-
-// Instantiate a WT5001 serial MP3 player on uart 0.
-// This example was tested on the Grove Serial MP3 module.
-
-var myMP3Player = new MP3Player.WT5001(0);
-
-var cmd = -1;
-if (process.argv.length > 2)
- cmd = parseInt(process.argv[2]);
-
-if (!myMP3Player.setupTty(MP3Player.int_B9600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(0);
-}
-
-switch (cmd)
-{
- case 0:
- myMP3Player.stop();
- break;
-
- case 1:
- myMP3Player.play(MP3Player.WT5001.SD, 1);
- break;
-
- case 2:
- myMP3Player.pause();
- break;
-
- case 3:
- myMP3Player.next();
- break;
-
- case 4:
- myMP3Player.previous();
- break;
-
- default:
- // nothing, just output usage, and info below
- printUsage(process.argv[1]);
- break;
-}
-
-// print out some information
-var vol = new MP3Player.uint8Array(0);
-myMP3Player.getVolume(vol);
-console.log("The current volume is: " + vol.getitem(0));
-
-var ps = new MP3Player.uint8Array(0);
-myMP3Player.getPlayState(ps);
-console.log("The current play state is: " + ps.getitem(0));
-
-var numf = new MP3Player.uint16Array(0);
-myMP3Player.getNumFiles(MP3Player.WT5001.SD, numf);
-console.log("The number of files on the SD card is: " + numf.getitem(0));
-
-var curf = new MP3Player.uint16Array(0);
-myMP3Player.getCurrentFile(curf);
-console.log("The current file is: " + curf.getitem(0));
-
-// set the date
-myMP3Player.setDate(2015, 3, 14);
-
-// set the time
-myMP3Player.setTime(9, 26, 53);
-
-var year = new MP3Player.uint16Array(0);
-var month = new MP3Player.uint8Array(0);
-var day = new MP3Player.uint8Array(0);
-myMP3Player.getDate(year, month, day);
-var mp3date = month.getitem(0) + "/";
-mp3date += (day.getitem(0) + "/");
-mp3date += year.getitem(0);
-console.log("The device date is: " + mp3date);
-
-var hour = new MP3Player.uint8Array(0);
-var minute = new MP3Player.uint8Array(0);
-var second = new MP3Player.uint8Array(0);
-myMP3Player.getTime(hour, minute, second);
-var mp3time = hour.getitem(0) + ":";
-mp3time += (minute.getitem(0) + ":");
-mp3time += second.getitem(0);
-console.log("The device time is: " + mp3time);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/xbee.js b/peripheral/libupm/examples/javascript/xbee.js
deleted file mode 100644
index bd8603e..0000000
--- a/peripheral/libupm/examples/javascript/xbee.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-
-/*
- * Author: Jon Trulson <jtrulson@ics.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-var sensorObj = require('jsupm_xbee');
-
-
-/************** Functions **************/
-function printUsage(progname)
-{
- var outputStr = "Usage: " + progname + " [AT command]\n\n" +
- "If an argument is supplied on the command line, that argument is\n" +
- "sent to the module and the response is printed out.\n\n" +
- "If no argument is used, then the firmware revision, serial number\n" +
- "and the current IP address (if set) are queried.\n\n"
- console.log(outputStr);
-}
-
-// simple helper function to send a command and wait for a response
-function sendCommand(sensor, cmd)
-{
- // commands need to be terminated with a carriage return
- cmd += "\r";
- sensor.writeDataStr(cmd);
-
- var resp = "";
- while (sensor.dataAvailable(2000))
- {
- resp += sensor.readDataStr(1024);
- }
-
- if (!resp)
- {
- console.log("Timed out waiting for response");
- }
- else
- {
- resp = sensor.stringCR2LF(resp);
- console.log("Returned (" + resp.length + " bytes):");
- console.log(resp);
- }
-}
-
-/************** Main code **************/
-// Instantiate a XBEE Module on UART 0
-var sensor = new sensorObj.XBee(0);
-
-// Set the baud rate, 9600 baud is the default.
-if (sensor.setBaudRate(9600))
-{
- console.log("Failed to set baud rate");
- process.exit(0);
-}
-
-printUsage(process.argv[1]);
-
-// Note: in nodeJS, command-line argument 0 is "node".
-// Command-line argument 1 is "xbee.js"
-// If you have a third argument, then it's a command
-if (process.argv.length > 2)
-{
- // enable command mode
- sensor.commandMode();
- console.log("Sending command line argument (" + process.argv[2] + ")...");
- sendCommand(sensor, process.argv[2]);
-}
-else
-{
- // enable command mode
- sensor.commandMode();
- // query the verbose firmware revision
- console.log("Querying verbose firmware revision (ATVL)...");
- sendCommand(sensor, "ATVL");
- // query the number
- console.log("Querying Serial Number High (ATSH)...");
- sendCommand(sensor, "ATSH");
- console.log("Querying Serial Number Low (ATSL)...");
- sendCommand(sensor, "ATSL");
-
- console.log("Querying address, if set (ATMY)...");
- sendCommand(sensor, "ATMY");
-
- // For the XBee WiFi S6B
- // A comprehensive list of commands and command modes is
- // available from the datasheet at:
- // ftp1.digi.com/support/documentation/90002180_L.pdf
-
- // For the XBee S1
- // A comprehensive list of commands and command modes is
- // available from the datasheet at:
- // http://www.sparkfun.com/datasheets/Wireless/Zigbee/XBee-Datasheet.pdf
-
- // For the XBee WiFi module:
- // An example using AT commands to connect to an AP, with a
- // private Key using WPA2:
-
- // Connect to AP with SSID 'mySSID':
- // ATIDmySSID
-
- // Provide the private key 'secret':
- // ATPKsecret
-
- // Use WPA2 encryption
- // ATEE2
-}
-
-
-/************** Exit code **************/
-process.on('SIGINT', function()
-{
- sensor = null;
- sensorObj.cleanUp();
- sensorObj = null;
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/yg1006.js b/peripheral/libupm/examples/javascript/yg1006.js
deleted file mode 100644
index be6887d..0000000
--- a/peripheral/libupm/examples/javascript/yg1006.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*global */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2014 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var flameSensor = require('jsupm_yg1006');
-
-// Instantiate a flame sensor on digital pin D2
-var myFlameSensor = new flameSensor.YG1006(2);
-
-// Check every second for the presence of a flame
-setInterval(function()
-{
- if (myFlameSensor.flameDetected())
- console.log("Flame detected.");
- else
- console.log("No flame detected.");
-}, 1000);
-
-// Print message when exiting
-process.on('SIGINT', function()
-{
- console.log("Exiting...");
- process.exit(0);
-});
diff --git a/peripheral/libupm/examples/javascript/zfm20-register.js b/peripheral/libupm/examples/javascript/zfm20-register.js
deleted file mode 100644
index 53938ed..0000000
--- a/peripheral/libupm/examples/javascript/zfm20-register.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var fingerprint_lib = require('jsupm_zfm20');
-
-// Instantiate a ZFM20 Fingerprint reader on UART 0
-var myFingerprintSensor = new fingerprint_lib.ZFM20(0);
-
-// make sure port is initialized properly. 57600 baud is the default.
-if (!myFingerprintSensor.setupTty(fingerprint_lib.int_B57600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(1);
-}
-
-// This example demonstrates registering a fingerprint on the zfm20
-// module. The procedure is as follows:
-//
-// 1. get an image, store it in characteristics buffer 1
-// 2. get another image, store it in characteristics buffer 2
-// 3. store the image, assuming the two fingerprints match
-
-// first, we need to register our address and password
-myFingerprintSensor.setPassword(fingerprint_lib.ZFM20_DEFAULT_PASSWORD);
-myFingerprintSensor.setAddress(fingerprint_lib.ZFM20_DEFAULT_ADDRESS);
-
-// now verify the password. If this fails, any other commands
-// will be ignored, so we just bail.
-if (myFingerprintSensor.verifyPassword())
- console.log("Password verified.");
-else
-{
- console.log("Password verification failed.");
- process.exit(1);
-}
-
-console.log(" ");
-
-// get the first image
-console.log("Place a finger on the sensor.");
-while (myFingerprintSensor.generateImage() != fingerprint_lib.ZFM20.ERR_OK)
- ;
-
-// in theory, we have an image
-console.log("Image captured, converting...");
-
-var rv = myFingerprintSensor.image2Tz(1);
-
-if (rv != fingerprint_lib.ZFM20.ERR_OK)
-{
- console.log("Image conversion failed with error code " + rv);
- process.exit(1)
-}
-
-console.log("Image conversion succeeded, remove finger.");
-setTimeout(function()
-{
- while (myFingerprintSensor.generateImage() != fingerprint_lib.ZFM20.ERR_NO_FINGER)
- ;
-
- console.log(" ");
- console.log("Now place the same finger on the sensor.");
-
- while (myFingerprintSensor.generateImage() == fingerprint_lib.ZFM20.ERR_NO_FINGER)
- ;
-
- console.log("Image captured, converting...");
-
- // save this one in slot 2
- rv = myFingerprintSensor.image2Tz(2)
- if (rv != fingerprint_lib.ZFM20.ERR_OK)
- {
- console.log("Image conversion failed with error code %d" + rv);
- process.exit(1);
- }
-
- console.log("Image conversion succeeded, remove finger.");
- console.log(" ");
-
- console.log("Storing fingerprint at id 1");
-
- // create the model
- rv = myFingerprintSensor.createModel()
- if (rv != fingerprint_lib.ZFM20.ERR_OK)
- {
- if (rv == fingerprint_lib.ZFM20.ERR_FP_ENROLLMISMATCH)
- console.log("Fingerprints did not match.");
- else
- console.log("createModel failed with error code " + rv);
- process.exit(1);
- }
-
- // now store it, we hard code the id (second arg) to 1 here
- rv = myFingerprintSensor.storeModel(1, 1);
- if (rv != fingerprint_lib.ZFM20.ERR_OK)
- {
- console.log("storeModel failed with error code " + rv);
- process.exit(1);
- }
-
- console.log(" ");
- console.log("Fingerprint stored at id 1.");
-}, 1000);
-
-// Print message when exiting
-function exit()
-{
- myFingerprintSensor = null;
- fingerprint_lib.cleanUp();
- fingerprint_lib = null;
- console.log("Exiting");
- process.exit(0);
-}
-process.on('exit', exit);
-process.on('SIGINT', exit);
diff --git a/peripheral/libupm/examples/javascript/zfm20.js b/peripheral/libupm/examples/javascript/zfm20.js
deleted file mode 100644
index 5733e9d..0000000
--- a/peripheral/libupm/examples/javascript/zfm20.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/*jslint node:true, vars:true, bitwise:true, unparam:true */
-/*jshint unused:true */
-/*
-* Author: Zion Orent <zorent@ics.com>
-* Copyright (c) 2015 Intel Corporation.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var fingerprint_lib = require('jsupm_zfm20');
-
-// Instantiate a ZFM20 Fingerprint reader on UART 0
-var myFingerprintSensor = new fingerprint_lib.ZFM20(0);
-
-// make sure port is initialized properly. 57600 baud is the default.
-if (!myFingerprintSensor.setupTty(fingerprint_lib.int_B57600))
-{
- console.log("Failed to setup tty port parameters");
- process.exit(1);
-}
-
-// how many valid stored templates (fingerprints) do we have?
-console.log("Total stored templates: " + myFingerprintSensor.getNumTemplates());
-console.log(" ");
-
-// now spin waiting for a fingerprint to successfully image
-console.log("Waiting for finger print...");
-
-while (myFingerprintSensor.generateImage() == fingerprint_lib.ZFM20.ERR_NO_FINGER)
- ;
-
-// in theory, we have an image
-console.log("Image captured, converting...");
-
-var rv = myFingerprintSensor.image2Tz(1);
-if (rv != fingerprint_lib.ZFM20.ERR_OK)
-{
- console.log("Image conversion failed with error code " + rv);
- process.exit(1);
-}
-
-console.log("Image conversion succeeded.");
-console.log("Searching database...");
-
-var myid = new fingerprint_lib.uint16Array(0);
-myid.setitem(0, 0);
-var myscore = new fingerprint_lib.uint16Array(0);
-myscore.setitem(0, 0);
-
-// we search for a print matching slot 1, where we stored our last
-// converted fingerprint
-rv = myFingerprintSensor.search(1, myid, myscore)
-if (rv != fingerprint_lib.ZFM20.ERR_OK)
-{
- if (rv == fingerprint_lib.ZFM20.ERR_FP_NOTFOUND)
- {
- console.log("Finger Print not found");
- process.exit(0);
- }
- else
- {
- console.log("Search failed with error code " + rv);
- process.exit(1);
- }
-}
-
-console.log("Fingerprint found!");
-console.log("ID: " + myid.getitem(0) + ", Score: " + myscore.getitem(0));
-
-
-// Print message when exiting
-function exit()
-{
- myFingerprintSensor = null;
- fingerprint_lib.cleanUp();
- fingerprint_lib = null;
- console.log("Exiting");
- process.exit(0);
-}
-process.on('SIGINT', exit);
-process.on('exit', exit);
diff --git a/peripheral/libupm/examples/python/a110x.py b/peripheral/libupm/examples/python/a110x.py
deleted file mode 100644
index 15ba01e..0000000
--- a/peripheral/libupm/examples/python/a110x.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_a110x as upmA110x
-
-# Instantiate a Hall Effect magnet sensor on digital pin D2
-myHallEffectSensor = upmA110x.A110X(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myHallEffectSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myHallEffectSensor.magnetDetected()):
- print "Magnet (south polarity) detected."
- else:
- print "No magnet detected."
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ad8232.py b/peripheral/libupm/examples/python/ad8232.py
deleted file mode 100644
index 97284ad..0000000
--- a/peripheral/libupm/examples/python/ad8232.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ad8232 as upmAD8232
-
-# Instantiate a AD8232 sensor on digital pins 10 (LO+), 11 (LO-)
-# and an analog pin, 0 (OUTPUT)
-myAD8232 = upmAD8232.AD8232(10, 11, 0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myAD8232
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Output the raw numbers from the ADC, for plotting elsewhere.
-# A return of 0 indicates a Lead Off (LO) condition.
-# In theory, this data could be fed to software like Processing
-# (https://www.processing.org/) to plot the data just like an
-# EKG you would see in a hospital.
-while(1):
- print myAD8232.value()
- time.sleep(.001)
diff --git a/peripheral/libupm/examples/python/adafruitms1438-stepper.py b/peripheral/libupm/examples/python/adafruitms1438-stepper.py
deleted file mode 100644
index 5385951..0000000
--- a/peripheral/libupm/examples/python/adafruitms1438-stepper.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_adafruitms1438 as upmAdafruitms1438
-
-
-# Import header values
-I2CBus = upmAdafruitms1438.ADAFRUITMS1438_I2C_BUS
-I2CAddr = upmAdafruitms1438.ADAFRUITMS1438_DEFAULT_I2C_ADDR
-
-M12Motor = upmAdafruitms1438.AdafruitMS1438.STEPMOTOR_M12
-MotorDirCW = upmAdafruitms1438.AdafruitMS1438.DIR_CW
-MotorDirCCW = upmAdafruitms1438.AdafruitMS1438.DIR_CCW
-
-
-# Instantiate an Adafruit MS 1438 on I2C bus 0
-myMotorShield = upmAdafruitms1438.AdafruitMS1438(I2CBus, I2CAddr)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myMotorShield
-def exitHandler():
- myMotorShield.disableStepper(M12Motor)
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Setup for use with a stepper motor connected to the M1 & M2 ports
-
-# set a PWM period of 50Hz
-
-# disable first, to be safe
-myMotorShield.disableStepper(M12Motor)
-
-# configure for a NEMA-17, 200 steps per revolution
-myMotorShield.stepConfig(M12Motor, 200)
-
-# set speed at 10 RPM's
-myMotorShield.setStepperSpeed(M12Motor, 10);
-myMotorShield.setStepperDirection(M12Motor, MotorDirCW)
-
-# enable
-print "Enabling..."
-myMotorShield.enableStepper(M12Motor)
-
-print "Rotating 1 full revolution at 10 RPM speed."
-myMotorShield.stepperSteps(M12Motor, 200)
-
-print "Sleeping for 2 seconds..."
-time.sleep(2)
-print "Rotating 1/2 revolution in opposite direction at 10 RPM speed."
-
-myMotorShield.setStepperDirection(M12Motor, MotorDirCCW)
-myMotorShield.stepperSteps(M12Motor, 100)
-
-print "Disabling..."
-
-# exitHandler runs automatically
diff --git a/peripheral/libupm/examples/python/adafruitms1438.py b/peripheral/libupm/examples/python/adafruitms1438.py
deleted file mode 100644
index 816bbe5..0000000
--- a/peripheral/libupm/examples/python/adafruitms1438.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_adafruitms1438 as upmAdafruitms1438
-
-
-# Import header values
-I2CBus = upmAdafruitms1438.ADAFRUITMS1438_I2C_BUS
-I2CAddr = upmAdafruitms1438.ADAFRUITMS1438_DEFAULT_I2C_ADDR
-
-M3Motor = upmAdafruitms1438.AdafruitMS1438.MOTOR_M3
-MotorDirCW = upmAdafruitms1438.AdafruitMS1438.DIR_CW
-MotorDirCCW = upmAdafruitms1438.AdafruitMS1438.DIR_CCW
-
-
-# Instantiate an Adafruit MS 1438 on I2C bus 0
-myMotorShield = upmAdafruitms1438.AdafruitMS1438(I2CBus, I2CAddr)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myMotorShield
-def exitHandler():
- myMotorShield.disableMotor(M3Motor)
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Setup for use with a DC motor connected to the M3 port
-
-# set a PWM period of 50Hz
-myMotorShield.setPWMPeriod(50)
-
-# disable first, to be safe
-myMotorShield.disableMotor(M3Motor)
-
-# set speed at 50%
-myMotorShield.setMotorSpeed(M3Motor, 50)
-myMotorShield.setMotorDirection(M3Motor, MotorDirCW)
-
-print ("Spin M3 at half speed for 3 seconds, "
-"then reverse for 3 seconds.")
-myMotorShield.enableMotor(M3Motor)
-
-time.sleep(3)
-
-print "Reversing M3"
-myMotorShield.setMotorDirection(M3Motor, MotorDirCCW)
-
-time.sleep(3)
-
-print "Stopping M3"
-
-# exitHandler runs automatically
diff --git a/peripheral/libupm/examples/python/adc121c021.py b/peripheral/libupm/examples/python/adc121c021.py
deleted file mode 100644
index 61500c4..0000000
--- a/peripheral/libupm/examples/python/adc121c021.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_adc121c021 as upmAdc121c021
-
-# Instantiate an ADC121C021 on I2C bus 0
-busID = upmAdc121c021.ADC121C021_I2C_BUS
-I2CAddr = upmAdc121c021.ADC121C021_DEFAULT_I2C_ADDR
-
-myAnalogDigitalConv = upmAdc121c021.ADC121C021(busID, I2CAddr)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myAnalogDigitalConv
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# get the data every 50 milliseconds
-while(1):
- val = myAnalogDigitalConv.value()
- voltsVal = myAnalogDigitalConv.valueToVolts(val)
- print "ADC value: %s Volts = %s" % (val, voltsVal)
- time.sleep(.05)
diff --git a/peripheral/libupm/examples/python/adxl335.py b/peripheral/libupm/examples/python/adxl335.py
deleted file mode 100644
index bc62181..0000000
--- a/peripheral/libupm/examples/python/adxl335.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_adxl335 as upmAdxl335
-
-myAnalogAccel = upmAdxl335.ADXL335(0, 1, 2)
-
-print "Please make sure the sensor is completely still."
-print "Sleeping for 2 seconds"
-time.sleep(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myAnalogAccel
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-print "Calibrating..."
-myAnalogAccel.calibrate()
-
-x = upmAdxl335.new_intPointer()
-y = upmAdxl335.new_intPointer()
-z = upmAdxl335.new_intPointer()
-
-aX = upmAdxl335.new_floatPointer()
-aY = upmAdxl335.new_floatPointer()
-aZ = upmAdxl335.new_floatPointer()
-
-while (1):
- myAnalogAccel.values(x, y, z)
- outputStr = "Raw Values: X: {0} Y: {1} Z: {2}".format(
- upmAdxl335.intPointer_value(x), upmAdxl335.intPointer_value(y),
- upmAdxl335.intPointer_value(z))
- print outputStr
-
- myAnalogAccel.acceleration(aX, aY, aZ)
- outputStr = ("Acceleration: X: {0}g\n"
- "Acceleration: Y: {1}g\n"
- "Acceleration: Z: {2}g").format(upmAdxl335.floatPointer_value(aX),
- upmAdxl335.floatPointer_value(aY),
- upmAdxl335.floatPointer_value(aZ))
- print outputStr
-
- print " "
-
- time.sleep(.2)
diff --git a/peripheral/libupm/examples/python/adxl345.py b/peripheral/libupm/examples/python/adxl345.py
deleted file mode 100644
index d19110a..0000000
--- a/peripheral/libupm/examples/python/adxl345.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from time import sleep
-import pyupm_adxl345 as adxl345
-
-# Create an I2C accelerometer object
-adxl = adxl345.Adxl345(0)
-
-# Loop indefinitely
-while True:
-
- adxl.update() # Update the data
- raw = adxl.getRawValues() # Read raw sensor data
- force = adxl.getAcceleration() # Read acceleration force (g)
- print "Raw: %6d %6d %6d" % (raw[0], raw[1], raw[2])
- print "ForceX: %5.2f g" % (force[0])
- print "ForceY: %5.2f g" % (force[1])
- print "ForceZ: %5.2f g\n" % (force[2])
-
- # Sleep for 1 s
- sleep(1)
diff --git a/peripheral/libupm/examples/python/adxrs610.py b/peripheral/libupm/examples/python/adxrs610.py
deleted file mode 100644
index 5183e7b..0000000
--- a/peripheral/libupm/examples/python/adxrs610.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_adxrs610 as sensorObj
-
-# Instantiate a ADXRS610 sensor on analog pin A0 (dataout), and
-# analog A1 (temp out) with an analog reference voltage of
-# 5.0
-sensor = sensorObj.ADXRS610(0, 1, 5.0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# set a deadband region around the zero point to report 0.0 (optional)
-sensor.setDeadband(0.015);
-
-# Every tenth of a second, sample the ADXRS610 and output it's
-# corresponding temperature and angular velocity
-
-while (1):
- print "Vel (deg/s):", sensor.getAngularVelocity()
- print "Temp (C):", sensor.getTemperature()
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/ak8975.py b/peripheral/libupm/examples/python/ak8975.py
deleted file mode 100644
index ad19df9..0000000
--- a/peripheral/libupm/examples/python/ak8975.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mpu9150 as sensorObj
-
-# Instantiate an AK8975 on I2C bus 0
-sensor = sensorObj.AK8975()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-sensor.init()
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getMagnetometer(x, y, z)
- print "Magnetometer: MX: ", sensorObj.floatp_value(x),
- print " MY: ", sensorObj.floatp_value(y),
- print " MZ: ", sensorObj.floatp_value(z)
-
- print
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/apds9002.py b/peripheral/libupm/examples/python/apds9002.py
deleted file mode 100644
index f9ea3cb..0000000
--- a/peripheral/libupm/examples/python/apds9002.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_apds9002 as upmApds9002
-
-# Instantiate a Grove Luminance sensor on analog pin A0
-myLuminance = upmApds9002.APDS9002(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myLuminance
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- print "Luminance value is {0}".format(
- myLuminance.value())
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/at42qt1070.py b/peripheral/libupm/examples/python/at42qt1070.py
deleted file mode 100644
index 06addfe..0000000
--- a/peripheral/libupm/examples/python/at42qt1070.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_at42qt1070 as upmAt42qt1070
-
-# functions
-def printButtons(touchObj):
- buttonPressed = False
- buttons = touchObj.getButtons()
-
- sys.stdout.write("Buttons Pressed: ")
- for i in range(7):
- if (buttons & (1 << i)):
- sys.stdout.write(str(i) + " ")
- buttonPressed = True
-
- if (not buttonPressed):
- sys.stdout.write("None")
-
- print " "
-
- if (touchObj.isCalibrating()):
- print "Calibration is occurring."
-
- if (touchObj.isOverflowed()):
- print "Overflow was detected."
-
-
-# Global code that runs on startup
-
-I2C_BUS = upmAt42qt1070.AT42QT1070_I2C_BUS
-DEFAULT_I2C_ADDR = upmAt42qt1070.AT42QT1070_DEFAULT_I2C_ADDR
-
-# Instantiate an AT42QT1070 on I2C bus 0
-myTouchSensor = upmAt42qt1070.AT42QT1070(I2C_BUS,
- DEFAULT_I2C_ADDR)
-
-
-# Exit handlers
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-
-# This function lets you run code on exit, including functions from myTouchSensor
-atexit.register(exitHandler)
-# This function stops python from printing a stacktrace when you hit control-C
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Print the button being touched every 0.1 seconds
-while(1):
- myTouchSensor.updateState()
- printButtons(myTouchSensor)
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/biss0001.py b/peripheral/libupm/examples/python/biss0001.py
deleted file mode 100644
index ba8901d..0000000
--- a/peripheral/libupm/examples/python/biss0001.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_biss0001 as upmMotion
-
-# Instantiate a Grove Motion sensor on GPIO pin D2
-myMotion = upmMotion.BISS0001(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMotion
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Read the value every second and detect motion
-while(1):
- if (myMotion.value()):
- print "Detecting moving object"
- else:
- print "No moving objects detected"
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/bma220.py b/peripheral/libupm/examples/python/bma220.py
deleted file mode 100644
index 9db6cdf..0000000
--- a/peripheral/libupm/examples/python/bma220.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_bma220 as sensorObj
-
-# Instantiate an BMA220 using default parameters (bus 0, addr 0x0a)
-sensor = sensorObj.BMA220()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getAccelerometer(x, y, z)
- print "Accelerometer: AX:", sensorObj.floatp_value(x),
- print " AY:", sensorObj.floatp_value(y),
- print " AZ:", sensorObj.floatp_value(z)
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/bmpx8x.py b/peripheral/libupm/examples/python/bmpx8x.py
deleted file mode 100644
index 017fba5..0000000
--- a/peripheral/libupm/examples/python/bmpx8x.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_bmpx8x as upmBmpx8x
-
-# Load Barometer module on i2c
-myBarometer = upmBmpx8x.BMPX8X(0, upmBmpx8x.ADDR);
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myBarometer
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Print the pressure, altitude, sea level, and
-# temperature values every 0.1 seconds
-while(1):
- outputStr = ("pressure value = {0}"
- ", altitude value = {1}"
- ", sealevel value = {2}"
- ", temperature = {3}".format(
- myBarometer.getPressure(),
- myBarometer.getTemperature(),
- myBarometer.getAltitude(),
- myBarometer.getSealevelPressure()))
-
- print outputStr
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/buzzer.py b/peripheral/libupm/examples/python/buzzer.py
deleted file mode 100644
index b1a3d18..0000000
--- a/peripheral/libupm/examples/python/buzzer.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_buzzer as upmBuzzer
-
-# Create the buzzer object using GPIO pin 5
-buzzer = upmBuzzer.Buzzer(5)
-
-chords = [upmBuzzer.DO, upmBuzzer.RE, upmBuzzer.MI, upmBuzzer.FA,
- upmBuzzer.SOL, upmBuzzer.LA, upmBuzzer.SI, upmBuzzer.DO,
- upmBuzzer.SI];
-
-# Print sensor name
-print buzzer.name()
-
-# Play sound (DO, RE, MI, etc.), pausing for 0.1 seconds between notes
-for chord_ind in range (0,7):
- # play each note for one second
- print buzzer.playSound(chords[chord_ind], 1000000)
- time.sleep(0.1)
-
-print "exiting application"
-
-# Delete the buzzer object
-del buzzer
diff --git a/peripheral/libupm/examples/python/cjq4435.py b/peripheral/libupm/examples/python/cjq4435.py
deleted file mode 100644
index a4ed268..0000000
--- a/peripheral/libupm/examples/python/cjq4435.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from __future__ import division
-import time
-import pyupm_cjq4435 as upmCjq4435
-
-# Instantiate a CJQ4435 MOSFET on a PWM capable digital pin D3
-myMOSFETsensor = upmCjq4435.CJQ4435(3)
-
-
-myMOSFETsensor.setPeriodMS(10)
-myMOSFETsensor.enable(True)
-
-# start with a duty cycle of 0.0 (off) and increment to 1.0 (on)
-for i in range(11):
- myMOSFETsensor.setDutyCycle(i / 10)
- time.sleep(.1)
-time.sleep(1)
-
-# Now take it back down
-# start with a duty cycle of 1.0 (on) and decrement to 0.0 (off)
-for i in range(10, -1, -1):
- myMOSFETsensor.setDutyCycle(i / 10)
- time.sleep(.1)
-time.sleep(1)
diff --git a/peripheral/libupm/examples/python/dfrph.py b/peripheral/libupm/examples/python/dfrph.py
deleted file mode 100644
index 1fadf03..0000000
--- a/peripheral/libupm/examples/python/dfrph.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_dfrph as sensorObj
-
-# Instantiate a DFRPH sensor on analog pin A0, with an analog
-# reference voltage of 5.0
-sensor = sensorObj.DFRPH(0, 5.0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# After calibration, set the offset (based on calibration with a pH
-# 7.0 buffer solution). See the UPM sensor documentation for
-# calibrations instructions.
-sensor.setOffset(0.065);
-
-# Every second, sample the pH and output it's corresponding
-# analog voltage.
-
-while (1):
- print "Detected volts: ", sensor.volts()
- print "pH value: ", sensor.pH()
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ds1307.py b/peripheral/libupm/examples/python/ds1307.py
deleted file mode 100644
index 7d35d8e..0000000
--- a/peripheral/libupm/examples/python/ds1307.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ds1307 as upmDs1307
-
-# load RTC clock on i2c bus 0
-myRTCClock = upmDs1307.DS1307(0)
-
-def printTime(RTCObj):
- timeStr = "The time is: {0}/{1}/{2} {3}:{4}:{5}".format(
- RTCObj.month, RTCObj.dayOfMonth, RTCObj.year,
- RTCObj.hours, RTCObj.minutes, RTCObj.seconds)
-
- if (RTCObj.amPmMode):
- timeStr += (" PM " if RTCObj.pm else " AM ")
-
- print timeStr
-
- print "Clock is in", ("AM/PM mode"
- if RTCObj.amPmMode else "24hr mode")
-
-
-# always do this first
-print "Loading the current time... "
-result = myRTCClock.loadTime()
-if (not result):
- print "myRTCClock.loadTime() failed."
- sys.exit(0)
-
-printTime(myRTCClock);
-
-# set the year as an example
-print "setting the year to 50"
-myRTCClock.year = 50
-myRTCClock.setTime()
-
-# reload the time and print it
-myRTCClock.loadTime()
-printTime(myRTCClock)
diff --git a/peripheral/libupm/examples/python/eboled.py b/peripheral/libupm/examples/python/eboled.py
deleted file mode 100644
index b33aaba..0000000
--- a/peripheral/libupm/examples/python/eboled.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys
-
-import pyupm_i2clcd as lcdObj
-
-# setup with default values
-lcd = lcdObj.EBOLED();
-
-lcd.clear();
-lcd.setCursor(10, 15);
-lcd.write("Hello");
-lcd.setCursor(30, 15);
-lcd.write("World!");
-lcd.refresh();
-print "Sleeping for 5 seconds..."
-time.sleep(5)
-
-
-
diff --git a/peripheral/libupm/examples/python/enc03r.py b/peripheral/libupm/examples/python/enc03r.py
deleted file mode 100644
index 45db89f..0000000
--- a/peripheral/libupm/examples/python/enc03r.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_enc03r as upmEnc03r
-
-# Instantiate an ENC03R on analog pin A0
-myAnalogGyro = upmEnc03r.ENC03R(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myAnalogGyro
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-CALIBRATION_SAMPLES = 1000
-
-print ("Please place the sensor in a stable location,\n"
-"and do not move it while calibration takes place.\n"
-"This may take a couple of minutes.")
-
-myAnalogGyro.calibrate(CALIBRATION_SAMPLES)
-print "Calibration complete. "
-print "Reference value: ", myAnalogGyro.calibrationValue()
-
-while(1):
- gyroVal = myAnalogGyro.value();
- outputStr = ("Raw value: {0}, "
- "angular velocity: {1}"
- " deg/s".format(gyroVal, myAnalogGyro.angularVelocity(gyroVal)))
- print outputStr
-
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/es08a.py b/peripheral/libupm/examples/python/es08a.py
deleted file mode 100644
index 09a1284..0000000
--- a/peripheral/libupm/examples/python/es08a.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# Author: John Van Drasek <john.r.van.drasek@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_servo as servo
-
-# Create the servo object using D5
-gServo = servo.ES08A(5)
-
-for i in range(0,10):
- # Set the servo arm to 0 degrees
- gServo.setAngle(0)
- print 'Set angle to 0'
- time.sleep(1)
-
- # Set the servo arm to 90 degrees
- gServo.setAngle(90)
- print 'Set angle to 90'
- time.sleep(1)
-
- # Set the servo arm to 180 degrees
- gServo.setAngle(180)
- print 'Set angle to 180'
- time.sleep(1)
-
-# Delete the servo object
-del gServo
diff --git a/peripheral/libupm/examples/python/gp2y0a.py b/peripheral/libupm/examples/python/gp2y0a.py
deleted file mode 100644
index f736d2c..0000000
--- a/peripheral/libupm/examples/python/gp2y0a.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gp2y0a as upmGp2y0a
-
-# Note, for the Grove 80cm version of this sensor, due to the way it is wired,
-# you need to plug this into the A0 port, where it will use the available
-# A1 pin for data.
-# Instantiate a GP2Y0A on analog pin A1
-myIRProximity = upmGp2y0a.GP2Y0A(1)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myIRProximity
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# analog voltage, usually 3.3 or 5.0
-GP2Y0A_AREF = 5.0;
-SAMPLES_PER_QUERY = 20;
-
-# The higher the voltage (closer to AREF) the closer the object is.
-# NOTE: The measured voltage will probably not exceed 3.3 volts.
-# Every second, print the averaged voltage value
-# (averaged over 20 samples).
-while (1):
- print "AREF: {0}, Voltage value (higher means closer): {1}".format(
- GP2Y0A_AREF,
- myIRProximity.value(GP2Y0A_AREF, SAMPLES_PER_QUERY))
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/grovebutton.py b/peripheral/libupm/examples/python/grovebutton.py
deleted file mode 100644
index c62c399..0000000
--- a/peripheral/libupm/examples/python/grovebutton.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grove as grove
-
-# Create the button object using GPIO pin 0
-button = grove.GroveButton(0)
-
-# Read the input and print, waiting one second between readings
-while 1:
- print button.name(), ' value is ', button.value()
- time.sleep(1)
-
-# Delete the button object
-del button
diff --git a/peripheral/libupm/examples/python/grovecircularled.py b/peripheral/libupm/examples/python/grovecircularled.py
deleted file mode 100644
index 1c5a485..0000000
--- a/peripheral/libupm/examples/python/grovecircularled.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-#
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_my9221 as upmGroveCircularLED
-
-# Exit handlers
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-def exitHandler():
- circle.setLevel(0, True)
- print "Exiting"
- sys.exit(0)
-
-# This function lets you run code on exit
-atexit.register(exitHandler)
-# This function stops python from printing a stacktrace when you hit control-C
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Instantiate a Grove Circular LED on gpio pins 9 and 8
-circle = upmGroveCircularLED.GroveCircularLED(9, 8)
-
-level = 0
-
-while(1):
- circle.setSpinner(level)
- level = (level + 1) % 24
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/grovecollision.py b/peripheral/libupm/examples/python/grovecollision.py
deleted file mode 100644
index 6cdd05c..0000000
--- a/peripheral/libupm/examples/python/grovecollision.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovecollision as upmGrovecollision
-
-# The was tested with the Grove Collision Sensor
-# Instantiate a Grove Collision on digital pin D2
-myGrovecollision = upmGrovecollision.GroveCollision(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myGrovecollision
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-collisionState = False
-print "No collision"
-
-while(1):
- if (myGrovecollision.isColliding() and not collisionState):
- print "Collision!"
- collisionState = True
- elif (not myGrovecollision.isColliding() and collisionState):
- print "No collision"
- collisionState = False
diff --git a/peripheral/libupm/examples/python/groveehr.py b/peripheral/libupm/examples/python/groveehr.py
deleted file mode 100644
index 3dd0ee2..0000000
--- a/peripheral/libupm/examples/python/groveehr.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_groveehr as upmGroveehr
-
-# Instantiate a Grove Ear-clip Heart Rate sensor on digital pin D2
-myHeartRateSensor = upmGroveehr.GroveEHR(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myHeartRateSensor
-def exitHandler():
- myHeartRateSensor.stopBeatCounter()
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# set the beat counter to 0, init the clock and start counting beats
-myHeartRateSensor.clearBeatCounter()
-myHeartRateSensor.initClock()
-myHeartRateSensor.startBeatCounter()
-
-while(1):
- # we grab these (millis and flowCount) just for display
- # purposes in this example
- millis = myHeartRateSensor.getMillis()
- beats = myHeartRateSensor.beatCounter()
-
- # heartRate() requires that at least 5 seconds pass before
- # returning anything other than 0
- fr = myHeartRateSensor.heartRate()
-
- # output milliseconds passed, beat count, and computed heart rate
- outputStr = "Millis: {0} Beats: {1} Heart Rate: {2}".format(
- millis, beats, fr)
- print outputStr
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/groveeldriver.py b/peripheral/libupm/examples/python/groveeldriver.py
deleted file mode 100644
index c9fd936..0000000
--- a/peripheral/libupm/examples/python/groveeldriver.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_groveeldriver as upmGroveeldriver
-
-# The was tested with the Grove El Driver Module
-# Instantiate a Grove El Driver on digital pin D2
-myEldriver = upmGroveeldriver.GroveElDriver(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myEldriver
-def exitHandler():
- print "Exiting"
- myEldriver.off()
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-lightState = True
-
-while(1):
- if (lightState):
- myEldriver.on()
- else:
- myEldriver.off()
- lightState = not lightState
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/groveelectromagnet.py b/peripheral/libupm/examples/python/groveelectromagnet.py
deleted file mode 100644
index c84af68..0000000
--- a/peripheral/libupm/examples/python/groveelectromagnet.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_groveelectromagnet as upmGroveelectromagnet
-
-# This was tested with the Grove Electromagnetic Module
-# Instantiate a Grove Electromagnet on digital pin D2
-myElectromagnet = upmGroveelectromagnet.GroveElectromagnet(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myElectromagnet
-def exitHandler():
- print "Exiting"
- myElectromagnet.off()
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-magnetState = False
-
-# Turn magnet on and off every 5 seconds
-while(1):
- magnetState = not magnetState
- if (magnetState):
- myElectromagnet.on()
- else:
- myElectromagnet.off()
- print "Turning magnet", ("on" if magnetState else "off")
-
- time.sleep(5)
diff --git a/peripheral/libupm/examples/python/groveemg.py b/peripheral/libupm/examples/python/groveemg.py
deleted file mode 100644
index 898db26..0000000
--- a/peripheral/libupm/examples/python/groveemg.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_groveemg as upmGroveemg
-
-# Tested with the GroveEMG Muscle Signal Reader Sensor Module
-# Instantiate a GroveEMG on analog pin A0
-myEMG = upmGroveemg.GroveEMG(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myEMG
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-print "Calibrating...."
-myEMG.calibrate()
-
-while (1):
- print myEMG.value()
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/grovegprs.py b/peripheral/libupm/examples/python/grovegprs.py
deleted file mode 100644
index d441e38..0000000
--- a/peripheral/libupm/examples/python/grovegprs.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovegprs as sensorObj
-
-# Instantiate a GroveGPRS Module on UART 0
-sensor = sensorObj.GroveGPRS(0)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Set the baud rate, 19200 baud is the default.
-if (sensor.setBaudRate(19200)):
- print "Failed to set baud rate"
- sys.exit(0)
-
-
-usageStr = ("Usage:\n"
-"If an argument is supplied on the command line, that argument is\n"
-"sent to the module and the response is printed out.\n\n"
-"If no argument is used, then the manufacturer and the current\n"
-"saved profiles are queried and the results printed out.\n\n")
-print usageStr
-
-# simple helper function to send a command and wait for a response
-def sendCommand(sensor, cmd):
- # commands need to be terminated with a carriage return
- cmd += "\r";
- sensor.writeDataStr(cmd)
-
- # wait up to 1 second
- if (sensor.dataAvailable(1000)):
- print "Returned: ",
- print sensor.readDataStr(1024)
- else:
- print "Timed out waiting for response"
-
-
-if (len(sys.argv) > 1):
- print "Sending command line argument (" + sys.argv[1] + ")..."
- sendCommand(sensor, sys.argv[1])
-else:
- # query the module manufacturer
- print "Querying module manufacturer (AT+CGMI)..."
- sendCommand(sensor, "AT+CGMI");
-
- time.sleep(1);
-
- # query the saved profiles
- print "Querying the saved profiles (AT&V)..."
- sendCommand(sensor, "AT&V");
-
- # A comprehensive list is available from the datasheet at:
- # http://www.seeedstudio.com/wiki/images/7/72/AT_Commands_v1.11.pdf
diff --git a/peripheral/libupm/examples/python/grovegsr.py b/peripheral/libupm/examples/python/grovegsr.py
deleted file mode 100644
index 993a6b0..0000000
--- a/peripheral/libupm/examples/python/grovegsr.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovegsr as upmGrovegsr
-
-# Tested with the GroveGSR Galvanic Skin Response Sensor module.
-
-# Instantiate a GroveGSR on analog pin A0
-myGSR = upmGrovegsr.GroveGSR(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myGSR
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-print "Calibrating...."
-myGSR.calibrate()
-
-while (1):
- print myGSR.value()
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/groveled.py b/peripheral/libupm/examples/python/groveled.py
deleted file mode 100644
index eb104bf..0000000
--- a/peripheral/libupm/examples/python/groveled.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grove as grove
-
-# Create the Grove LED object using GPIO pin 2
-led = grove.GroveLed(2)
-
-# Print the name
-print led.name()
-
-# Turn the LED on and off 10 times, pausing one second
-# between transitions
-for i in range (0,10):
- led.on()
- time.sleep(1)
- led.off()
- time.sleep(1)
-
-# Delete the Grove LED object
-del led
diff --git a/peripheral/libupm/examples/python/groveledbar.py b/peripheral/libupm/examples/python/groveledbar.py
deleted file mode 100644
index 39d8462..0000000
--- a/peripheral/libupm/examples/python/groveledbar.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_my9221 as upmMy9221
-
-# Instantiate a MY9221, we use D8 for the data, and D9 for the
-# data clock. This was tested with a Grove LED bar.
-myLEDBar = upmMy9221.GroveLEDBar(8, 9)
-
-
-# Exit handlers
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-def exitHandler():
- myLEDBar.setBarLevel(0, True)
- print "Exiting"
- sys.exit(0)
-
-# This function lets you run code on exit
-atexit.register(exitHandler)
-# This function stops python from printing a stacktrace when you hit control-C
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-directionBool = True
-level = 1
-
-x = 0
-while(1):
- # If it's less than 10
- # light up the LED now
- # call show_LED again in 50 ms
- if (level <= 10):
- myLEDBar.setBarLevel(level, directionBool)
- level += 1
- # Switch LED lighting directions between lighting cycles
- else:
- directionBool = not directionBool
- level = 1
- time.sleep(1)
- time.sleep(.05)
- x += 1
diff --git a/peripheral/libupm/examples/python/grovelight.py b/peripheral/libupm/examples/python/grovelight.py
deleted file mode 100644
index a1939d7..0000000
--- a/peripheral/libupm/examples/python/grovelight.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grove as grove
-
-# Create the light sensor object using AIO pin 0
-light = grove.GroveLight(0)
-
-# Read the input and print both the raw value and a rough lux value,
-# waiting one second between readings
-while 1:
- print light.name() + " raw value is %d" % light.raw_value() + \
- ", which is roughly %d" % light.value() + " lux";
- time.sleep(1)
-
-# Delete the light sensor object
-del light
diff --git a/peripheral/libupm/examples/python/grovelinefinder.py b/peripheral/libupm/examples/python/grovelinefinder.py
deleted file mode 100644
index bdcd68a..0000000
--- a/peripheral/libupm/examples/python/grovelinefinder.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovelinefinder as upmGrovelinefinder
-
-# Instantiate a Grove line finder sensor on digital pin D2
-myLineFinder = upmGrovelinefinder.GroveLineFinder(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myLineFinder
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myLineFinder.whiteDetected()):
- print "White detected."
- else:
- print "Black detected."
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/grovemd-stepper.py b/peripheral/libupm/examples/python/grovemd-stepper.py
deleted file mode 100644
index 7bafae5..0000000
--- a/peripheral/libupm/examples/python/grovemd-stepper.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grovemd as upmGrovemd
-
-I2C_BUS = upmGrovemd.GROVEMD_I2C_BUS
-I2C_ADDR = upmGrovemd.GROVEMD_DEFAULT_I2C_ADDR
-
-# Instantiate an I2C Grove Motor Driver on I2C bus 0
-myMotorDriver = upmGrovemd.GroveMD(I2C_BUS, I2C_ADDR)
-
-# This example demonstrates using the GroveMD to drive a stepper motor
-
-# configure it, for this example, we'll assume 200 steps per rev
-myMotorDriver.configStepper(200)
-
-# set for half a rotation
-myMotorDriver.setStepperSteps(100)
-
-# let it go - clockwise rotation, 10 RPM speed
-myMotorDriver.enableStepper(upmGrovemd.GroveMD.STEP_DIR_CW, 10)
-
-time.sleep(3)
-
-# Now do it backwards...
-myMotorDriver.setStepperSteps(100)
-myMotorDriver.enableStepper(upmGrovemd.GroveMD.STEP_DIR_CCW, 10)
-
-# now disable
-myMotorDriver.disableStepper()
-
diff --git a/peripheral/libupm/examples/python/grovemd.py b/peripheral/libupm/examples/python/grovemd.py
deleted file mode 100644
index ac4243d..0000000
--- a/peripheral/libupm/examples/python/grovemd.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grovemd as upmGrovemd
-
-I2C_BUS = upmGrovemd.GROVEMD_I2C_BUS
-I2C_ADDR = upmGrovemd.GROVEMD_DEFAULT_I2C_ADDR
-
-# Instantiate an I2C Grove Motor Driver on I2C bus 0
-myMotorDriver = upmGrovemd.GroveMD(I2C_BUS, I2C_ADDR)
-
-
-# set direction to CW and set speed to 50%
-print "Spin M1 and M2 at half speed for 3 seconds"
-myMotorDriver.setMotorDirections(upmGrovemd.GroveMD.DIR_CW, upmGrovemd.GroveMD.DIR_CW)
-myMotorDriver.setMotorSpeeds(127, 127)
-
-time.sleep(3)
-# counter clockwise
-print "Reversing M1 and M2 for 3 seconds"
-myMotorDriver.setMotorDirections(upmGrovemd.GroveMD.DIR_CCW,
-upmGrovemd.GroveMD.DIR_CCW)
-time.sleep(3)
-
-print "Stopping motors"
-myMotorDriver.setMotorSpeeds(0, 0)
diff --git a/peripheral/libupm/examples/python/grovemoisture.py b/peripheral/libupm/examples/python/grovemoisture.py
deleted file mode 100644
index 78d3fe4..0000000
--- a/peripheral/libupm/examples/python/grovemoisture.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovemoisture as upmMoisture
-
-# Instantiate a Grove Moisture sensor on analog pin A0
-myMoisture = upmMoisture.GroveMoisture(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMoisture
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Values (approximate):
-# 0-300, sensor in air or dry soil
-# 300-600, sensor in humid soil
-# 600+, sensor in wet soil or submerged in water
-
-# Read the value every second and print the corresponding moisture level
-while(1):
- moisture_val = myMoisture.value()
- if (moisture_val >= 0 and moisture_val < 300):
- result = "Dry"
- elif (moisture_val >= 300 and moisture_val < 600):
- result = "Moist"
- else:
- result = "Wet"
- print "Moisture value: {0}, {1}".format(moisture_val, result)
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/groveo2.py b/peripheral/libupm/examples/python/groveo2.py
deleted file mode 100644
index 03f612b..0000000
--- a/peripheral/libupm/examples/python/groveo2.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_groveo2 as upmGroveo2
-
-# This was tested with the O2 Oxygen Concentration Sensor Module
-# Instantiate a GroveO2 on analog pin A0
-myGroveO2 = upmGroveo2.GroveO2(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myGroveO2
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- print "The output voltage is: {0}mV".format(
- myGroveO2.voltageValue())
-
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/groverelay.py b/peripheral/libupm/examples/python/groverelay.py
deleted file mode 100644
index 44f033f..0000000
--- a/peripheral/libupm/examples/python/groverelay.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grove as grove
-
-# Create the relay switch object using GPIO pin 0
-relay = grove.GroveRelay(0)
-
-# Close and then open the relay switch 3 times,
-# waiting one second each time. The LED on the relay switch
-# will light up when the switch is on (closed).
-# The switch will also make a noise between transitions.
-for i in range (0,3):
- relay.on()
- if relay.isOn():
- print relay.name(), 'is on'
- time.sleep(1)
- relay.off()
- if relay.isOff():
- print relay.name(), 'is off'
- time.sleep(1)
-
-# Delete the relay switch object
-del relay
diff --git a/peripheral/libupm/examples/python/groverotary.py b/peripheral/libupm/examples/python/groverotary.py
deleted file mode 100644
index 6d62c3c..0000000
--- a/peripheral/libupm/examples/python/groverotary.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from time import sleep
-import pyupm_grove as grove
-
-# New knob on AIO pin 0
-knob = grove.GroveRotary(0)
-
-# Loop indefinitely
-while True:
-
- # Read values
- abs = knob.abs_value()
- absdeg = knob.abs_deg()
- absrad = knob.abs_rad()
-
- rel = knob.rel_value()
- reldeg = knob.rel_deg()
- relrad = knob.rel_rad()
-
- print "Abs values: %4d" % int(abs) , " raw %4d" % int(absdeg), "deg = %5.2f" % absrad , " rad ",
- print "Rel values: %4d" % int(rel) , " raw %4d" % int(reldeg), "deg = %5.2f" % relrad , " rad"
-
- # Sleep for 2.5 s
- sleep(2.5)
diff --git a/peripheral/libupm/examples/python/grovescam.py b/peripheral/libupm/examples/python/grovescam.py
deleted file mode 100644
index 53ede09..0000000
--- a/peripheral/libupm/examples/python/grovescam.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/python
-#
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import sys
-import pyupm_grovescam as upmGrovescam
-
-# Instantiate a Grove Serial Camera on UART 0
-camera = upmGrovescam.GROVESCAM(0)
-
-# make sure port is initialized properly. 115200 baud is the default.
-if (not camera.setupTty()):
- print "Failed to setup tty port parameters"
- sys.exit(1)
-
-if (camera.init()):
- print "Initialized..."
-else:
- print "init() failed"
-
-if (camera.preCapture()):
- print "preCapture succeeded..."
-else:
- print "preCapture failed."
-
-if (camera.doCapture()):
- print "doCapture succeeded..."
-else:
- print "doCapture failed."
-
-print "Image size is", camera.getImageSize(), "bytes"
-
-if (camera.getImageSize() > 0):
- print "Storing image.jpg..."
- if (camera.storeImage("image.jpg")):
- print "storeImage succeeded..."
- else:
- print "storeImage failed."
-
-print "Exiting."
-sys.exit(0)
diff --git a/peripheral/libupm/examples/python/groveslide.py b/peripheral/libupm/examples/python/groveslide.py
deleted file mode 100644
index 894fdc8..0000000
--- a/peripheral/libupm/examples/python/groveslide.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from time import sleep
-import pyupm_grove as grove
-
-# New Grove Slider on AIO pin 0
-slider = grove.GroveSlide(0)
-
-# Loop indefinitely
-while True:
-
- # Read values
- raw = slider.raw_value()
- volts = slider.voltage_value()
-
- print "Slider value: ", raw , " = %.2f" % volts , " V"
-
- # Sleep for 2.5 s
- sleep(2.5)
diff --git a/peripheral/libupm/examples/python/grovespeaker.py b/peripheral/libupm/examples/python/grovespeaker.py
deleted file mode 100644
index 6e53b3c..0000000
--- a/peripheral/libupm/examples/python/grovespeaker.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovespeaker as upmGrovespeaker
-
-# Instantiate a Grove Speaker on digital pin D2
-mySpeaker = upmGrovespeaker.GroveSpeaker(2)
-
-# Play all 7 of the lowest notes
-mySpeaker.playAll()
-
-# Play a medium C-sharp
-mySpeaker.playSound('c', True, "med")
diff --git a/peripheral/libupm/examples/python/grovetemp.py b/peripheral/libupm/examples/python/grovetemp.py
deleted file mode 100644
index bd9cc24..0000000
--- a/peripheral/libupm/examples/python/grovetemp.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Author: Brendan Le Foll <brendan.le.foll@intel.com>
-# Contributions: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_grove as grove
-
-# Create the temperature sensor object using AIO pin 0
-temp = grove.GroveTemp(0)
-print temp.name()
-
-# Read the temperature ten times, printing both the Celsius and
-# equivalent Fahrenheit temperature, waiting one second between readings
-for i in range(0, 10):
- celsius = temp.value()
- fahrenheit = celsius * 9.0/5.0 + 32.0;
- print "%d degrees Celsius, or %d degrees Fahrenheit" \
- % (celsius, fahrenheit)
- time.sleep(1)
-
-# Delete the temperature sensor object
-del temp
diff --git a/peripheral/libupm/examples/python/grovevdiv.py b/peripheral/libupm/examples/python/grovevdiv.py
deleted file mode 100644
index 7719277..0000000
--- a/peripheral/libupm/examples/python/grovevdiv.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovevdiv as upmGrovevdiv
-
-# Instantiate a Grove Voltage Divider sensor on analog pin A0
-myVoltageDivider = upmGrovevdiv.GroveVDiv(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myVoltageDivider
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- val = myVoltageDivider.value(100)
- gain3val = myVoltageDivider.computedValue(3, val)
- gain10val = myVoltageDivider.computedValue(10, val)
- print "ADC value: {0} Gain 3: {1}v Gain 10: {2}v".format(
- val, gain3val, gain10val)
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/grovewater.py b/peripheral/libupm/examples/python/grovewater.py
deleted file mode 100644
index 54a3d14..0000000
--- a/peripheral/libupm/examples/python/grovewater.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovewater as upmGrovewater
-
-# Instantiate a Grove Water sensor on digital pin D2
-myWaterSensor = upmGrovewater.GroveWater(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myWaterSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myWaterSensor.isWet()):
- print "Sensor is wet"
- else:
- print "Sensor is dry"
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/grovewfs.py b/peripheral/libupm/examples/python/grovewfs.py
deleted file mode 100644
index 84c5a97..0000000
--- a/peripheral/libupm/examples/python/grovewfs.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_grovewfs as upmGrovewfs
-
-# Instantiate a Grove Water Flow Sensor on digital pin D2
-myWaterFlow = upmGrovewfs.GroveWFS(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myWaterFlow
-def exitHandler():
- myWaterFlow.stopFlowCounter()
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# set the flow counter to 0 and start counting
-myWaterFlow.clearFlowCounter()
-myWaterFlow.startFlowCounter()
-
-while (1):
- # we grab these (millis and flowCount) just for display
- # purposes in this example
- millis = myWaterFlow.getMillis()
- flowCount = myWaterFlow.flowCounter()
-
- fr = myWaterFlow.flowRate()
-
- # output milliseconds passed, flow count, and computed flow rate
- outputStr = "Millis: {0} Flow Count: {1} Flow Rate: {2} LPM".format(
- millis, flowCount, fr)
- print outputStr
- time.sleep(2)
diff --git a/peripheral/libupm/examples/python/guvas12d.py b/peripheral/libupm/examples/python/guvas12d.py
deleted file mode 100644
index dca8de8..0000000
--- a/peripheral/libupm/examples/python/guvas12d.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_guvas12d as upmUV
-
-# Instantiate a UV sensor on analog pin A0
-myUVSensor = upmUV.GUVAS12D(0);
-
-# analog voltage, usually 3.3 or 5.0
-GUVAS12D_AREF = 5.0;
-SAMPLES_PER_QUERY = 1024;
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myUVSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- s = ("AREF: {0}, "
- "Voltage value (higher means more UV): "
- "{1}".format(GUVAS12D_AREF,
- myUVSensor.value(GUVAS12D_AREF, SAMPLES_PER_QUERY)))
- print s
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/h3lis331dl.py b/peripheral/libupm/examples/python/h3lis331dl.py
deleted file mode 100644
index 60142f5..0000000
--- a/peripheral/libupm/examples/python/h3lis331dl.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_h3lis331dl as upmH3LIS331DL
-
-# Instantiate an H3LIS331DL on I2C bus 0
-myDigitalAccelerometer = upmH3LIS331DL.H3LIS331DL(
- upmH3LIS331DL.H3LIS331DL_I2C_BUS,
- upmH3LIS331DL.H3LIS331DL_DEFAULT_I2C_ADDR);
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myDigitalAccelerometer
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Initialize the device with default values
-myDigitalAccelerometer.init()
-
-x = upmH3LIS331DL.new_intp()
-y = upmH3LIS331DL.new_intp()
-z = upmH3LIS331DL.new_intp()
-
-ax = upmH3LIS331DL.new_floatp()
-ay = upmH3LIS331DL.new_floatp()
-az = upmH3LIS331DL.new_floatp()
-
-while (1):
- myDigitalAccelerometer.update()
- myDigitalAccelerometer.getRawXYZ(x, y, z)
- outputStr = ("Raw: X = {0}"
- " Y = {1}"
- " Z = {2}").format(upmH3LIS331DL.intp_value(x),
- upmH3LIS331DL.intp_value(y),
- upmH3LIS331DL.intp_value(z))
- print outputStr
-
- myDigitalAccelerometer.getAcceleration(ax, ay, az)
- outputStr = ("Acceleration: AX = {0}"
- " AY = {1}"
- " AZ = {2}").format(upmH3LIS331DL.floatp_value(ax),
- upmH3LIS331DL.floatp_value(ay),
- upmH3LIS331DL.floatp_value(az))
- print outputStr
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/hdxxvxta.py b/peripheral/libupm/examples/python/hdxxvxta.py
deleted file mode 100644
index c539d90..0000000
--- a/peripheral/libupm/examples/python/hdxxvxta.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2016 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_hdxxvxta as sensorObj
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-print "Initializing..."
-
-# Instantiate an HDXXVXTA instance, using A1 for humidity and A0
-# for temperature
-sensor = sensorObj.HDXXVXTA(1, 0)
-
-# update and print available values every second
-while (1):
- # update our values from the sensor
- sensor.update()
-
- # we show both C and F for temperature
- print "Temperature:", sensor.getTemperature(), "C /",
- print sensor.getTemperature(True), "F"
-
- print "Humidity:", sensor.getHumidity(), "%"
-
- print
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/hm11.py b/peripheral/libupm/examples/python/hm11.py
deleted file mode 100644
index c20a8ea..0000000
--- a/peripheral/libupm/examples/python/hm11.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_hm11 as upmHm11
-
-# Instantiate a HM11 BLE Module on UART 0
-my_ble_obj = upmHm11.HM11(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from my_ble_obj
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-bufferLength = 256
-
-# make sure port is initialized properly. 9600 baud is the default.
-if (not my_ble_obj.setupTty(upmHm11.cvar.int_B9600)):
- print "Failed to setup tty port parameters"
- sys.exit(0)
-
-
-usageStr = ("Usage:\n"
-"Pass a commandline argument (any argument) to this program\n"
-"to query the radio configuration and output it. NOTE: the\n"
-"radio must be in CONFIG mode for this to work.\n\n"
-"Running this program without arguments will simply transmit\n"
-"'Hello World!' every second, and output any data received from\n"
-"another radio.\n\n")
-print usageStr
-
-# simple helper function to send a command and wait for a response
-def sendCommand(bleObj, cmd):
- bleBuffer = upmHm11.charArray(bufferLength)
- bleObj.writeData(cmd, len(cmd))
-
- # wait up to 1 second
- if (bleObj.dataAvailable(1000)):
- bleObj.readData(bleBuffer, bufferLength)
- bleData = ""
- # read only the number of characters
- # specified by myGPSSensor.readData
- for x in range(0, bufferLength):
- if (bleBuffer.__getitem__(x) == '\0'):
- break
- else:
- bleData += bleBuffer.__getitem__(x)
- print bleData
- else:
- print "Timed out waiting for response"
-
-
-if (len(sys.argv) > 1):
- print "Sending command line argument (" + sys.argv[1] + ")..."
- sendCommand(my_ble_obj, sys.argv[1])
-else:
- # query the module address
- addr = "AT+ADDR?";
- print "Querying module address (" + addr + ")..."
-
- sendCommand(my_ble_obj, addr)
- time.sleep(1)
- # query the module address
- pin = "AT+PASS?";
- print "Querying module PIN (" + pin + ")..."
- sendCommand(my_ble_obj, pin)
-
- # Other potentially useful commands are:
- #
- # AT+VERS? - query module version
- # AT+ROLE0 - set as slave
- # AT+ROLE1 - set as master
- # AT+CLEAR - clear all previous settings
- # AT+RESET - restart the device
- #
- # A comprehensive list is available from the datasheet at:
- # http://www.seeedstudio.com/wiki/images/c/cd/Bluetooth4_en.pdf
-
diff --git a/peripheral/libupm/examples/python/hmc5883l.py b/peripheral/libupm/examples/python/hmc5883l.py
deleted file mode 100644
index 5043073..0000000
--- a/peripheral/libupm/examples/python/hmc5883l.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from time import sleep
-import pyupm_hmc5883l as hmc5883l
-
-# Create an I2C compass object and set declination
-hmc = hmc5883l.Hmc5883l(0)
-hmc.set_declination(0.2749)
-
-# Loop indefinitely
-while True:
-
- hmc.update() # Update the data
- pos = hmc.coordinates() # Read raw coordinates
- hdg = hmc.heading() # Read heading
- dir = hmc.direction() # Read direction
-
- # Print values
- print "Coor: %5d %5d %5d" % (pos[0], pos[1], pos[2])
- print "Heading: %5.2f" % (hdg)
- print "Direction: %3.2f\n" % (dir)
-
- # Sleep for 1 s
- sleep(1)
diff --git a/peripheral/libupm/examples/python/hmtrp.py b/peripheral/libupm/examples/python/hmtrp.py
deleted file mode 100644
index dd2298f..0000000
--- a/peripheral/libupm/examples/python/hmtrp.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_hmtrp as upmHmtrp
-
-# Instantiate a HMTRP radio device on uart 0
-my_HMTRP_Radio = upmHmtrp.HMTRP(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from my_HMTRP_Radio
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-myCounter = 0
-
-# normal read/write mode
-bufferLength = 256
-radioBuffer = upmHmtrp.charArray(bufferLength)
-
-# make sure port is initialized properly. 9600 baud is the default.
-if (not my_HMTRP_Radio.setupTty(upmHmtrp.cvar.int_B9600)):
- print "Failed to setup tty port parameters"
- sys.exit(0)
-
-
-usageStr = ("Usage:\n"
-"Pass a commandline argument (any argument) to this program\n"
-"to query the radio configuration and output it. NOTE: the\n"
-"radio must be in CONFIG mode for this to work.\n\n"
-"Running this program without arguments will simply transmit\n"
-"'Hello World!' every second, and output any data received from\n"
-"another radio.\n\n")
-print usageStr
-
-'''
-By default, this radio simply transmits data sent via writeData()
-and reads any available data via readData().
-
-It can be placed into a configuration mode by grounding the
-CONFIG pin on the module. When this is done, the various
-configuration query and config methods can be used. In this
-example, by default, we just read any data available fom the
-device, and periodically transmit "Hello World".
-
-If any argument was specified on the command line, do a simple
-configuration query and output the results. The radio must be in
-CONFIG mode for this to work.
-
-
-Note that the first command-line argument should be "hmtry.py"
-The data we want would be the second... if it exists
-'''
-if (len(sys.argv) > 1):
- # config mode
- freq = upmHmtrp.uint32Array(0)
- dataRate = upmHmtrp.uint32Array(0)
- rxBandwidth = upmHmtrp.uint16Array(0)
- modulation = upmHmtrp.uint8Array(0)
- txPower = upmHmtrp.uint8Array(0)
- uartBaud = upmHmtrp.uint32Array(0)
-
- if (my_HMTRP_Radio.getConfig(freq, dataRate, rxBandwidth,
- modulation, txPower, uartBaud)):
- print "Radio configuration:"
- outputStr = ("freq: {0} dataRate: {1} "
- "rxBandwidth: {2}Khz").format(freq.__getitem__(0),
- dataRate.__getitem__(0),
- rxBandwidth.__getitem__(0))
- print outputStr
-
- outputStr = "modulation: %d Khz txPower: %d uartBaud: %d" % (
- modulation.__getitem__(0), txPower.__getitem__(0),
- uartBaud.__getitem__(0))
- print outputStr
- else:
- errString = ("getConfig() failed. Make sure the radio "
- "is in CONFIG mode.")
- print errString
-else:
- print "Running in normal read/write mode."
- while (1):
- # we don't want the read to block in this example, so always
- # check to see if data is available first.
- if (my_HMTRP_Radio.dataAvailable()):
- rv = my_HMTRP_Radio.readData(radioBuffer, bufferLength)
-
- if (rv > 0):
- resultStr = "";
- for x in range(rv):
- resultStr += radioBuffer.__getitem__(x)
- print "Received:", resultStr
-
- if (rv < 0): # some sort of read error occured
- print "Port read error."
- sys.exit(0)
- myCounter += 1
- # every second, transmit "Hello World"
- if (myCounter > 10):
- msg = "Hello World!"
-
- print "Transmitting %s..." % msg
-
- # Adding 1 for NULL terminator.
- # Note that SWIG automatically adds a NULL terminator,
- # so no need to NULL-terminate ourselves.
- # Just increment the message length to include
- # the NULL that's already there
- my_HMTRP_Radio.writeData(msg, (len(msg) + 1))
- myCounter = 0
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/hp20x.py b/peripheral/libupm/examples/python/hp20x.py
deleted file mode 100644
index f0ae5e6..0000000
--- a/peripheral/libupm/examples/python/hp20x.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_hp20x as barometerObj
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from ringCoder
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Instantiate an HP20X on default I2C bus and address
-bar = barometerObj.HP20X()
-
-# Initialize the device with default values
-bar.init()
-
-while(1):
- print "Temperature:", bar.getTemperature(), "Celcius"
- print "Pressure: ", bar.getPressure(), "Millibars"
- print "Altitude: ", bar.getAltitude(), "Meters"
- print
- time.sleep(1)
-
diff --git a/peripheral/libupm/examples/python/ht9170.py b/peripheral/libupm/examples/python/ht9170.py
deleted file mode 100644
index 838b0cc..0000000
--- a/peripheral/libupm/examples/python/ht9170.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ht9170 as upmHt9170
-
-# Instantiate a DTMF decoder
-myDTMF = upmHt9170.HT9170(12, 11, 10, 9, 8)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myDTMF
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Now we just spin in a loop, sleeping every 100ms, checking to see
-# if a digit is available. If so, we decode and print the digit,
-# and continue looping.
-while (1):
- if (dtmf_obj.digitReady()):
- print "Got DTMF code:", dtmf_obj.decodeDigit()
- # now spin until digitReady() goes false again
- while (dtmf.digitReady()):
- pass
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/hwxpxx.py b/peripheral/libupm/examples/python/hwxpxx.py
deleted file mode 100644
index 0def995..0000000
--- a/peripheral/libupm/examples/python/hwxpxx.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2016 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_hwxpxx as sensorObj
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting..."
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-defaultDev = "/dev/ttyUSB0"
-
-# if an argument was specified, use it as the device instead
-if (len(sys.argv) > 1):
- defaultDev = sys.argv[1]
-
-print "Using device", defaultDev
-print "Initializing..."
-
-# Instantiate an HWXPXX instance, using MODBUS slave address 3, and
-# default comm parameters (19200, 8, N, 2)
-sensor = sensorObj.HWXPXX(defaultDev, 3)
-
-# output the serial number and firmware revision
-print "Slave ID:", sensor.getSlaveID()
-
-# stored temperature and humidity offsets
-print "Temperature Offset:", sensor.getTemperatureOffset()
-print "Humidity Offset:", sensor.getHumidityOffset()
-
-print
-
-# update and print available values every second
-while (1):
- # update our values from the sensor
- sensor.update()
-
- # we show both C and F for temperature
- print "Temperature:", sensor.getTemperature(), "C /",
- print sensor.getTemperature(True), "F"
-
- print "Humidity:", sensor.getHumidity(), "%"
-
- print "Slider:", sensor.getSlider(), "%"
-
- print "Override Switch Status:", sensor.getOverrideSwitchStatus()
-
- print
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ili9341.py b/peripheral/libupm/examples/python/ili9341.py
deleted file mode 100644
index 5194cc3..0000000
--- a/peripheral/libupm/examples/python/ili9341.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/python
-# Author: Shawn Hymel
-# Copyright (c) 2016 SparkFun Electronics
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_ili9341 as ili9341
-
-# Pins (Edison)
-# CS_LCD GP44 (MRAA 31)
-# CS_SD GP43 (MRAA 38) unused
-# DC GP12 (MRAA 20)
-# RESEST GP13 (MRAA 14)
-lcd = ili9341.ILI9341(31, 38, 20, 14)
-
-# Fill the screen with a solid color
-lcd.fillScreen(lcd.color565(0, 40, 16))
-
-# Draw some shapes
-lcd.drawFastVLine(10, 10, 100, ili9341.ILI9341_RED)
-lcd.drawFastHLine(20, 10, 50, ili9341.ILI9341_CYAN)
-lcd.drawLine(160, 30, 200, 60, ili9341.ILI9341_GREEN)
-lcd.fillRect(20, 30, 75, 60, ili9341.ILI9341_ORANGE)
-lcd.drawCircle(70, 50, 20, ili9341.ILI9341_PURPLE)
-lcd.fillCircle(120, 50, 20, ili9341.ILI9341_PURPLE)
-lcd.drawTriangle(50, 100, 10, 140, 90, 140, ili9341.ILI9341_YELLOW)
-lcd.fillTriangle(150, 100, 110, 140, 190, 140, ili9341.ILI9341_YELLOW)
-lcd.drawRoundRect(20, 150, 50, 30, 10, ili9341.ILI9341_RED)
-lcd.drawRoundRect(130, 150, 50, 30, 10, ili9341.ILI9341_RED)
-lcd.fillRoundRect(75, 150, 50, 30, 10, ili9341.ILI9341_RED)
-
-# Write some text
-lcd.setCursor(0, 200)
-lcd.setTextColor(ili9341.ILI9341_LIGHTGREY)
-lcd.setTextWrap(True)
-lcd.setTextSize(1)
-lcd._print("Text 1\n")
-lcd.setTextSize(2)
-lcd._print("Text 2\n")
-lcd.setTextSize(3)
-lcd._print("Text 3\n")
-lcd.setTextSize(4)
-lcd._print("Text 4\n")
-
-# Test screen rotation
-for r in range(0, 4):
- lcd.setRotation(r)
- lcd.fillRect(0, 0, 5, 5, ili9341.ILI9341_WHITE)
- time.sleep(1)
-
-# Invert colors, wait, then revert back
-lcd.invertDisplay(True)
-time.sleep(2)
-lcd.invertDisplay(False)
-
-# Don't forget to free up that memory!
-del lcd \ No newline at end of file
diff --git a/peripheral/libupm/examples/python/ina132.py b/peripheral/libupm/examples/python/ina132.py
deleted file mode 100644
index 8db4862..0000000
--- a/peripheral/libupm/examples/python/ina132.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_ina132 as upmIna132
-
-# Tested with the INA132 Differential Amplifier Sensor module.
-# Instantiate an INA132 on analog pin A0
-myDifferentialAmplifier = upmIna132.INA132(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myDifferentialAmplifier
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- print myDifferentialAmplifier.value()
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/isd1820.py b/peripheral/libupm/examples/python/isd1820.py
deleted file mode 100644
index f39f477..0000000
--- a/peripheral/libupm/examples/python/isd1820.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, atexit
-import pyupm_isd1820 as upmIsd1820
-
-# Instantiate a ISD1820 on digital pins 2 (play) and 3 (record)
-# This example was tested on the Grove Recorder.
-myRecorder = upmIsd1820.ISD1820(2, 3)
-
-
-doRecord = False
-
-if len(sys.argv) > 1:
- doRecord = True
-
-
-# This lets you run code on exit,
-# including functions from myRecorder
-def exitHandler():
- # turn off whatever we were doing.
- if (doRecord):
- myRecorder.record(False)
- else:
- myRecorder.play(False)
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-
-
-# if an argument was specified (any argument), go into record mode,
-# else playback a previously recorded sample
-
-print "Supply any argument to the command line to record."
-print "Running this example without arguments will play back any "
-print "previously recorded sound."
-print "There is approximately 10 seconds of recording time.\n"
-
-
-# depending on what was selected, do it, and sleep for 15 seconds
-if (doRecord):
- myRecorder.record(True)
-else:
- myRecorder.play(True)
-
-# There are about 10 seconds of recording/playback time, so we will
-# sleep for a little extra time.
-print "Sleeping for 15 seconds..."
-time.sleep(15)
-
-
-# exitHandler runs automatically
diff --git a/peripheral/libupm/examples/python/itg3200.py b/peripheral/libupm/examples/python/itg3200.py
deleted file mode 100644
index cd4a7c4..0000000
--- a/peripheral/libupm/examples/python/itg3200.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Author: John Van Drasek <john.r.van.drasek@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_itg3200 as itg3200
-
-# Create an I2C gyro object
-gyro = itg3200.Itg3200(0)
-
-while(1):
- gyro.update() # Update the data
- rot = gyro.getRawValues() # Read raw sensor data
- ang = gyro.getRotation() # Read rotational speed (deg/sec)
- print "Raw: %6d %6d %6d" % (rot[0], rot[1], rot[2])
- print "AngX: %5.2f" % (ang[0])
- print "AngY: %5.2f" % (ang[1])
- print "AngZ: %5.2f" % (ang[2])
- print "Temp: %5.2f Raw: %6d" % (gyro.getTemperature(), gyro.getRawTemp())
- print ' '
- time.sleep(1)
-
-# Delete the gyro object
-del gyro
diff --git a/peripheral/libupm/examples/python/jhd1313m1-lcd.py b/peripheral/libupm/examples/python/jhd1313m1-lcd.py
deleted file mode 100644
index fc0bc65..0000000
--- a/peripheral/libupm/examples/python/jhd1313m1-lcd.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/python
-# Author: Brendan Le Foll <brendan.le.foll@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import pyupm_i2clcd as lcd
-
-# Initialize Jhd1313m1 at 0x3E (LCD_ADDRESS) and 0x62 (RGB_ADDRESS)
-myLcd = lcd.Jhd1313m1(0, 0x3E, 0x62)
-
-myLcd.setCursor(0,0)
-# RGB Blue
-#myLcd.setColor(53, 39, 249)
-
-# RGB Red
-myLcd.setColor(255, 0, 0)
-
-myLcd.write('Hello World')
-myLcd.setCursor(1,2)
-myLcd.write('Hello World')
diff --git a/peripheral/libupm/examples/python/joystick12.py b/peripheral/libupm/examples/python/joystick12.py
deleted file mode 100644
index eaae149..0000000
--- a/peripheral/libupm/examples/python/joystick12.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_joystick12 as upmJoystick12
-
-# Instantiate a joystick on analog pins A0 and A1
-myJoystick = upmJoystick12.Joystick12(0, 1)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myJoystick
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Print the X and Y input values every second
-while(1):
- XString = "Driving X:" + str(myJoystick.getXInput())
- YString = ": and Y:" + str(myJoystick.getYInput())
- print XString + YString
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/l298-stepper.py b/peripheral/libupm/examples/python/l298-stepper.py
deleted file mode 100644
index cfac86f..0000000
--- a/peripheral/libupm/examples/python/l298-stepper.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_l298 as upmL298
-
-# Instantiate a Stepper motor on a L298 Dual H-Bridge.
-# This was tested with the NEMA-17 12V, 350mA, with 200 steps per rev.
-myHBridge = upmL298.L298(200, 3, 4, 7, 8, 9)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myHBridge
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-myHBridge.setSpeed(10) # 10 RPMs
-myHBridge.setDirection(upmL298.L298.DIR_CW)
-myHBridge.enable(True)
-
-print "Rotating 1 full revolution at 10 RPM speed."
-# move 200 steps, a full rev
-myHBridge.stepperSteps(200)
-
-print "Sleeping for 2 seconds..."
-time.sleep(2)
-
-print "Rotating 1/2 revolution in opposite direction at 10 RPM speed."
-myHBridge.setDirection(upmL298.L298.DIR_CCW)
-myHBridge.stepperSteps(100)
-
-# release
-myHBridge.enable(False)
-
-# exitHandler is called automatically
diff --git a/peripheral/libupm/examples/python/l298.py b/peripheral/libupm/examples/python/l298.py
deleted file mode 100644
index f0b507c..0000000
--- a/peripheral/libupm/examples/python/l298.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_l298 as upmL298
-
-# Instantiate one of the 2 possible DC motors on a L298 Dual
-# H-Bridge. For controlling a stepper motor, see the l298-stepper
-# example.
-myHBridge = upmL298.L298(3, 4, 7)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myHBridge
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-print "Starting motor at 50% for 3 seconds..."
-myHBridge.setSpeed(50)
-myHBridge.setDirection(upmL298.L298.DIR_CW)
-myHBridge.enable(True)
-
-time.sleep(3)
-
-print "Reversing direction..."
-myHBridge.setDirection(upmL298.L298.DIR_NONE) # fast stop
-myHBridge.setDirection(upmL298.L298.DIR_CCW)
-time.sleep(3);
-
-myHBridge.setSpeed(0)
-myHBridge.enable(False)
-
-# exitHandler is called automatically
diff --git a/peripheral/libupm/examples/python/ldt0028.py b/peripheral/libupm/examples/python/ldt0028.py
deleted file mode 100644
index b6001a7..0000000
--- a/peripheral/libupm/examples/python/ldt0028.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import array
-import pyupm_ldt0028 as ldt0028
-
-NUMBER_OF_SECONDS = 10
-SAMPLES_PER_SECOND = 50
-THRESHOLD = 100
-
-# Create the LDT0-028 Piezo Vibration Sensor object using AIO pin 0
-sensor = ldt0028.LDT0028(0)
-
-# Read the signal every 20 milliseconds for 10 seconds
-print 'For the next', NUMBER_OF_SECONDS, 'seconds,', \
- SAMPLES_PER_SECOND, 'samples will be taken every second.\n'
-buffer = array.array('H')
-for i in range(0, NUMBER_OF_SECONDS * SAMPLES_PER_SECOND):
- buffer.append(sensor.getSample())
- time.sleep(1.0/SAMPLES_PER_SECOND)
-
-# Print the number of times the reading was greater than the threshold
-count = 0
-for i in range(0, NUMBER_OF_SECONDS * SAMPLES_PER_SECOND):
- if buffer[i] > THRESHOLD:
- count += 1
-print sensor.name(), ' exceeded the threshold value of', \
- THRESHOLD, 'a total of', count, 'times,'
-print 'out of a total of', NUMBER_OF_SECONDS*SAMPLES_PER_SECOND, \
- 'reading.\n'
-
-# Print a graphical representation of the average value sampled
-# each second for the past 10 seconds, using a scale factor of 15
-print 'Now printing a graphical representation of the average reading '
-print 'each second for the last', NUMBER_OF_SECONDS, 'seconds.'
-SCALE_FACTOR = 15
-for i in range(0, NUMBER_OF_SECONDS):
- sum = 0
- for j in range(0, SAMPLES_PER_SECOND):
- sum += buffer[i*SAMPLES_PER_SECOND+j]
- average = sum / SAMPLES_PER_SECOND
- stars_to_print = int(round(average / SCALE_FACTOR))
- print '(' + repr(int(round(average))).rjust(4) + ') |', '*' * stars_to_print
-
-# Delete the sensor object
-del sensor
diff --git a/peripheral/libupm/examples/python/lm35.py b/peripheral/libupm/examples/python/lm35.py
deleted file mode 100644
index 342f0a9..0000000
--- a/peripheral/libupm/examples/python/lm35.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_lm35 as sensorObj
-
-# Instantiate a LM35 on analog pin A0, with a default analog
-# reference voltage of 5.0
-sensor = sensorObj.LM35(0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Every half second, sample the sensor and output the temperature
-
-while (1):
- print "Temperature:", sensor.getTemperature(), "C"
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/loudness.py b/peripheral/libupm/examples/python/loudness.py
deleted file mode 100644
index 1b4101b..0000000
--- a/peripheral/libupm/examples/python/loudness.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_loudness as sensorObj
-
-# Instantiate a Loudness sensor on analog pin A0, with an analog
-# reference voltage of 5.0
-sensor = sensorObj.Loudness(0, 5.0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Every tenth of a second, sample the loudness and output it's
-# corresponding analog voltage.
-
-while (1):
- print "Detected loudness (volts): ", sensor.loudness()
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/lsm303.py b/peripheral/libupm/examples/python/lsm303.py
deleted file mode 100644
index adc4cd2..0000000
--- a/peripheral/libupm/examples/python/lsm303.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/python
-
-# Author: Brendan Le Foll <brendan.le.foll@intel.com>
-# Contributions: Zion Orent <zorent@ics.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
-
-import time, sys, signal, atexit
-import pyupm_lsm303 as lsm303
-
-# Instantiate LSM303 compass on I2C
-myAccelrCompass = lsm303.LSM303(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myAccelrCompass
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- # Load coordinates into LSM303 object
- successFail = myAccelrCompass.getCoordinates()
- # in XYZ order. The sensor returns XZY,
- # but the driver compensates and makes it XYZ
- coords = myAccelrCompass.getRawCoorData()
-
- # Print out the X, Y, and Z coordinate data
- # using two different methods
- outputStr = "coor: rX {0} - rY {1} - rZ {2}".format(
- coords.__getitem__(0), coords.__getitem__(1),
- coords.__getitem__(2))
- print outputStr
-
- outputStr = "coor: gX {0} - gY {1} - gZ {2}".format(
- myAccelrCompass.getCoorX(), myAccelrCompass.getCoorY(),
- myAccelrCompass.getCoorZ())
- print outputStr
-
- # Get and print out the heading
- print "heading:", myAccelrCompass.getHeading()
-
- # Get the acceleration
- myAccelrCompass.getAcceleration();
- accel = myAccelrCompass.getRawAccelData();
-
- # Print out the X, Y, and Z acceleration data
- # using two different methods
- outputStr = "acc: rX {0} - rY {1} - Z {2}".format(
- accel.__getitem__(0), accel.__getitem__(1), accel.__getitem__(2))
- print outputStr
-
- outputStr = "acc: gX {0} - gY {1} - gZ {2}".format(
- myAccelrCompass.getAccelX(), myAccelrCompass.getAccelY(),
- myAccelrCompass.getAccelZ())
- print outputStr
-
- print " "
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/lsm9ds0.py b/peripheral/libupm/examples/python/lsm9ds0.py
deleted file mode 100644
index 10edc94..0000000
--- a/peripheral/libupm/examples/python/lsm9ds0.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_lsm9ds0 as sensorObj
-
-# Instantiate an LSM9DS0 using default parameters (bus 1, gyro addr 6b,
-# xm addr 1d)
-sensor = sensorObj.LSM9DS0()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-sensor.init()
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getAccelerometer(x, y, z)
- print "Accelerometer: AX: ", sensorObj.floatp_value(x),
- print " AY: ", sensorObj.floatp_value(y),
- print " AZ: ", sensorObj.floatp_value(z)
-
- sensor.getGyroscope(x, y, z)
- print "Gyroscope: GX: ", sensorObj.floatp_value(x),
- print " GY: ", sensorObj.floatp_value(y),
- print " GZ: ", sensorObj.floatp_value(z)
-
- sensor.getMagnetometer(x, y, z)
- print "Magnetometer: MX: ", sensorObj.floatp_value(x),
- print " MY: ", sensorObj.floatp_value(y),
- print " MZ: ", sensorObj.floatp_value(z)
-
- print "Temperature: ", sensor.getTemperature()
- print
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/m24lr64e.py b/peripheral/libupm/examples/python/m24lr64e.py
deleted file mode 100644
index 848181e..0000000
--- a/peripheral/libupm/examples/python/m24lr64e.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import sys
-import pyupm_m24lr64e as nfcTagObj
-
-# Instantiate a M24LR64E Grove NFC Tag Module on UART 0
-nfcTag = nfcTagObj.M24LR64E(nfcTagObj.M24LR64E_I2C_BUS)
-
-# This example accesses the device in the 'user' (default) mode,
-# reads the last byte of data in the EEPROM, inverts it, writes
-# it back, and then re-reads it.
-
-# Read the last byte of the EEPROM area
-addr = (nfcTagObj.M24LR64E.EEPROM_I2C_LENGTH - 1)
-print "Address: ", addr
-byte = nfcTag.readByte(addr)
-
-print "Read byte: ", format(byte, '02x')
-
-# Now change it to it's opposite and write it
-byte = (~byte & 0xff)
-nfcTag.writeByte(addr, byte)
-print "Wrote inverted byte: ", format(byte, '02x')
-
-# Now read it back.
-byte = nfcTag.readByte(addr)
-print "Read byte: ", format(byte, '02x')
-
diff --git a/peripheral/libupm/examples/python/make_oled_pic.py b/peripheral/libupm/examples/python/make_oled_pic.py
deleted file mode 100755
index 85b3ca0..0000000
--- a/peripheral/libupm/examples/python/make_oled_pic.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-
-# Author: Brendan Le Foll <brendan.le.foll@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
-
-from __future__ import print_function
-
-from PIL import Image
-import sys
-
-# Pixels are arranged in one byte for 8 vertical pixels and not addressed individually
-# We convert the image to greysacle and end up making it monochrome where we
-# consider that every pixel that is '40' is black.
-
-width = 128
-height = 64
-
-if len(sys.argv) != 2:
- print('Please specify an image to use as the only argument')
- exit(1)
-
-im = Image.open(sys.argv[1])
-im = im.convert('L').resize((width, height))
-
-data = list(im.getdata())
-
-byteblock = [0 for i in range(width)]
-widthblock = [list(byteblock) for i in range(int(height/8))]
-numblock = 0
-pixcount = 0
-i = 0
-
-# we split the list by width * 8, to create data chunks of 8rows
-datachunks=[data[x:x+(width*8)] for x in range(0, len(data), (width*8))]
-
-# grab every pixel of image (or datachunk)
-while i < len(widthblock):
- pixcount = 0
- for y in datachunks[i]:
- xcoor = pixcount % width
- ycoor = int(pixcount/width)
- blknum = xcoor % len(widthblock)
- blkycoor = ycoor
-
- # 40 is what we consider 'black'
- if y > 40:
- widthblock[i][xcoor] |= (1 << blkycoor)
-
- pixcount += 1
- i += 1
-
-flatlist = [y for x in widthblock for y in x]
-
-carray = 'static uint8_t image[] = {\n' + ', '.join(str(x) for x in flatlist)
-print(carray + '\n};')
diff --git a/peripheral/libupm/examples/python/maxsonarez.py b/peripheral/libupm/examples/python/maxsonarez.py
deleted file mode 100644
index 645ca58..0000000
--- a/peripheral/libupm/examples/python/maxsonarez.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_maxsonarez as MaxSonarEZ
-
-# Instantiate a MaxSonar-EZ on analog pin A1, with an analog
-# reference voltage of MAXSONAREZ_AREF
-Sonar = MaxSonarEZ.MAXSONAREZ(1)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from Sonar
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# analog voltage, usually 3.3 or 5.0
-MAXSONAREZ_AREF = 5.0;
-
-# Every second, sample the sonar and output the distance to an
-# object in inches.
-
-# With the EZ3 version, the minimum and maximum ranges seemed to be
-# between 6 and 33 inches
-
-while (1):
- print "AREF: {0}, distance in inches: {1}".format(
- MAXSONAREZ_AREF,
- Sonar.inches())
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/mg811.py b/peripheral/libupm/examples/python/mg811.py
deleted file mode 100644
index 78a75d8..0000000
--- a/peripheral/libupm/examples/python/mg811.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mg811 as sensorObj
-
-# Instantiate an MG811 on analog pin A0, and digital pin D2 with an
-# analog reference voltage of MG811_AREF (5.0)
-
-sensor = sensorObj.MG811(0, 2, 5.0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Every tenth of a second, sample the sensor and output it's
-# detected CO2 concentration in parts per million (ppm)
-
-while (1):
- print "CO2 concentration in PPM: ", sensor.ppm()
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/mhz16.py b/peripheral/libupm/examples/python/mhz16.py
deleted file mode 100644
index 4fa0615..0000000
--- a/peripheral/libupm/examples/python/mhz16.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mhz16 as upmMhz16
-
-# Instantiate a MHZ16 serial CO2 sensor on uart 0.
-# This example was tested on the Grove CO2 sensor module.
-myCO2 = upmMhz16.MHZ16(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myCO2
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# make sure port is initialized properly. 9600 baud is the default.
-if (not myCO2.setupTty(upmMhz16.cvar.int_B9600)):
- print "Failed to setup tty port parameters"
- sys.exit(0)
-
-print ("Make sure that the sensor has had "
-"at least 3 minutes to warm up\n"
-"or you will not get valid results.\n"
-"The temperature reported is not the ambient temperature,\n"
-"but rather the temperature of the sensor elements.")
-
-time.sleep(1)
-
-while(1):
- if (not myCO2.getData()):
- print "Failed to retrieve data"
- else:
- outputStr = ("CO2 concentration: {0} PPM, "
- "Temperature (in C): {1}".format(
- myCO2.getGas(), myCO2.getTemperature()))
- print outputStr
-
- time.sleep(2)
diff --git a/peripheral/libupm/examples/python/mic.py b/peripheral/libupm/examples/python/mic.py
deleted file mode 100644
index 240d61e..0000000
--- a/peripheral/libupm/examples/python/mic.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Author: John Van Drasek <john.r.van.drasek@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_mic as upmMicrophone
-
-# Attach microphone to analog port A0
-myMic = upmMicrophone.Microphone(0)
-threshContext = upmMicrophone.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of dots as averages
-while(1):
- buffer = upmMicrophone.uint16Array(128)
- len = myMic.getSampledWindow(2, 128, buffer);
- if len:
- thresh = myMic.findThreshold(threshContext, 30, buffer, len)
- myMic.printGraph(threshContext)
- if(thresh):
- print "Threshold is ", thresh
-
-# Delete the upmMicrophone object
-del myMic
diff --git a/peripheral/libupm/examples/python/mma7660.py b/peripheral/libupm/examples/python/mma7660.py
deleted file mode 100644
index 1471a60..0000000
--- a/peripheral/libupm/examples/python/mma7660.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mma7660 as upmMMA7660
-
-# Instantiate an MMA7660 on I2C bus 0
-myDigitalAccelerometer = upmMMA7660.MMA7660(
- upmMMA7660.MMA7660_I2C_BUS,
- upmMMA7660.MMA7660_DEFAULT_I2C_ADDR);
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myDigitalAccelerometer
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# place device in standby mode so we can write registers
-myDigitalAccelerometer.setModeStandby()
-
-# enable 64 samples per second
-myDigitalAccelerometer.setSampleRate(upmMMA7660.MMA7660.AUTOSLEEP_64)
-
-# place device into active mode
-myDigitalAccelerometer.setModeActive()
-
-x = upmMMA7660.new_intp()
-y = upmMMA7660.new_intp()
-z = upmMMA7660.new_intp()
-
-ax = upmMMA7660.new_floatp()
-ay = upmMMA7660.new_floatp()
-az = upmMMA7660.new_floatp()
-
-while (1):
- myDigitalAccelerometer.getRawValues(x, y, z)
- outputStr = ("Raw values: x = {0}"
- " y = {1}"
- " z = {2}").format(upmMMA7660.intp_value(x),
- upmMMA7660.intp_value(y),
- upmMMA7660.intp_value(z))
- print outputStr
-
- myDigitalAccelerometer.getAcceleration(ax, ay, az)
- outputStr = ("Acceleration: x = {0}"
- "g y = {1}"
- "g z = {2}g").format(upmMMA7660.floatp_value(ax),
- upmMMA7660.floatp_value(ay),
- upmMMA7660.floatp_value(az))
- print outputStr
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/mpr121.py b/peripheral/libupm/examples/python/mpr121.py
deleted file mode 100644
index 8e38262..0000000
--- a/peripheral/libupm/examples/python/mpr121.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mpr121 as upmMpr121
-
-I2C_BUS = upmMpr121.MPR121_I2C_BUS
-DEFAULT_I2C_ADDR = upmMpr121.MPR121_DEFAULT_I2C_ADDR
-
-# Instantiate an MPR121 touch sensor on I2C
-myTouchSensor = upmMpr121.MPR121(I2C_BUS, DEFAULT_I2C_ADDR)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myTouchSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-
-def printButtons(touchSensor):
- buttonPressed = False
-
- outputStr = "Buttons Pressed: "
- for i in range(12):
- if (touchSensor.m_buttonStates & (1 << i)):
- outputStr += (str(i) + " ")
- buttonPressed = True
-
- if (not buttonPressed):
- outputStr += "None"
-
- print outputStr
-
- if (touchSensor.m_overCurrentFault):
- print "Over Current Fault detected!"
-
-
-while(1):
- myTouchSensor.readButtons()
- printButtons(myTouchSensor)
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/mpu60x0.py b/peripheral/libupm/examples/python/mpu60x0.py
deleted file mode 100644
index 009e3ee..0000000
--- a/peripheral/libupm/examples/python/mpu60x0.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mpu9150 as sensorObj
-
-# Instantiate an MPU60X0 on I2C bus 0
-sensor = sensorObj.MPU60X0()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-sensor.init()
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getAccelerometer(x, y, z)
- print "Accelerometer: AX: ", sensorObj.floatp_value(x),
- print " AY: ", sensorObj.floatp_value(y),
- print " AZ: ", sensorObj.floatp_value(z)
-
- sensor.getGyroscope(x, y, z)
- print "Gyroscope: GX: ", sensorObj.floatp_value(x),
- print " GY: ", sensorObj.floatp_value(y),
- print " GZ: ", sensorObj.floatp_value(z)
-
- print "Temperature: ", sensor.getTemperature()
- print
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/mpu9150.py b/peripheral/libupm/examples/python/mpu9150.py
deleted file mode 100644
index bba54b0..0000000
--- a/peripheral/libupm/examples/python/mpu9150.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mpu9150 as sensorObj
-
-# Instantiate an MPU9150 on I2C bus 0
-sensor = sensorObj.MPU9150()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-sensor.init()
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getAccelerometer(x, y, z)
- print "Accelerometer: AX: ", sensorObj.floatp_value(x),
- print " AY: ", sensorObj.floatp_value(y),
- print " AZ: ", sensorObj.floatp_value(z)
-
- sensor.getGyroscope(x, y, z)
- print "Gyroscope: GX: ", sensorObj.floatp_value(x),
- print " GY: ", sensorObj.floatp_value(y),
- print " GZ: ", sensorObj.floatp_value(z)
-
- sensor.getMagnetometer(x, y, z)
- print "Magnetometer: MX: ", sensorObj.floatp_value(x),
- print " MY: ", sensorObj.floatp_value(y),
- print " MZ: ", sensorObj.floatp_value(z)
-
- print "Temperature: ", sensor.getTemperature()
- print
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/mpu9250.py b/peripheral/libupm/examples/python/mpu9250.py
deleted file mode 100644
index 1653846..0000000
--- a/peripheral/libupm/examples/python/mpu9250.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_mpu9150 as sensorObj
-
-# Instantiate an MPU9250 on I2C bus 0
-sensor = sensorObj.MPU9250()
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-sensor.init()
-
-x = sensorObj.new_floatp()
-y = sensorObj.new_floatp()
-z = sensorObj.new_floatp()
-
-while (1):
- sensor.update()
- sensor.getAccelerometer(x, y, z)
- print "Accelerometer: AX: ", sensorObj.floatp_value(x),
- print " AY: ", sensorObj.floatp_value(y),
- print " AZ: ", sensorObj.floatp_value(z)
-
- sensor.getGyroscope(x, y, z)
- print "Gyroscope: GX: ", sensorObj.floatp_value(x),
- print " GY: ", sensorObj.floatp_value(y),
- print " GZ: ", sensorObj.floatp_value(z)
-
- sensor.getMagnetometer(x, y, z)
- print "Magnetometer: MX: ", sensorObj.floatp_value(x),
- print " MY: ", sensorObj.floatp_value(y),
- print " MZ: ", sensorObj.floatp_value(z)
-
- print "Temperature: ", sensor.getTemperature()
- print
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/mq2.py b/peripheral/libupm/examples/python/mq2.py
deleted file mode 100644
index 3073fda..0000000
--- a/peripheral/libupm/examples/python/mq2.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGas
-
-# Attach gas sensor to AIO0
-myMQ2 = upmGas.MQ2(0);
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMQ2
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGas.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of dots as averages
-mybuffer = upmGas.uint16Array(128)
-while(1):
- samplelen = myMQ2.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = myMQ2.findThreshold(threshContext, 30, mybuffer, samplelen)
- myMQ2.printGraph(threshContext, 5)
- if(thresh):
- print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq3.py b/peripheral/libupm/examples/python/mq3.py
deleted file mode 100644
index c464cfc..0000000
--- a/peripheral/libupm/examples/python/mq3.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGas
-
-# Attach gas sensor to AIO0
-myMQ3 = upmGas.MQ3(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMQ3
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGas.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of dots as averages
-mybuffer = upmGas.uint16Array(128)
-while(1):
- samplelen = myMQ3.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = myMQ3.findThreshold(threshContext, 30, mybuffer, samplelen)
- myMQ3.printGraph(threshContext, 5)
- if(thresh):
- print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq303a.py b/peripheral/libupm/examples/python/mq303a.py
deleted file mode 100644
index de71bcf..0000000
--- a/peripheral/libupm/examples/python/mq303a.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-
-# Load alcohol sensor module
-import pyupm_mq303a as upmMq303a
-
-# Instantiate an mq303a sensor on analog pin A0
-# This device uses a heater powered from an analog I/O pin.
-# If using A0 as the data pin, then you need to use A1, as the heater
-# pin (if using a grove mq303a). For A1, we can use the D15 gpio,
-# setup as an output, and drive it low to power the heater.
-myAlcoholSensor = upmMq303a.MQ303A(0, 15)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myAlcoholSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-print "Enabling heater and waiting 2 minutes for warmup."
-
-# give time updates every 30 seconds until 2 minutes have passed
-# for the alcohol sensor to warm up
-def warmup(iteration):
- totalSeconds = (30 * iteration)
- time.sleep(30)
- print totalSeconds, "seconds have passed"
-warmup(1)
-warmup(2)
-warmup(3)
-warmup(4)
-
-notice = ("This sensor may need to warm "
-"until the value drops below about 450.")
-print notice
-
-# Print the detected alcohol value every second
-while(1):
- val = myAlcoholSensor.value()
- msg = "Alcohol detected "
- msg += "(higher means stronger alcohol): "
- print msg + str(val)
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/mq4.py b/peripheral/libupm/examples/python/mq4.py
deleted file mode 100644
index 579246b..0000000
--- a/peripheral/libupm/examples/python/mq4.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGAS
-
-# Attach gas sensor to Analog A0
-sensor = upmGAS.MQ4(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from sensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGAS.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of asteriskss as averages
-mybuffer = upmGAS.uint16Array(128)
-while(1):
- samplelen = sensor.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = sensor.findThreshold(threshContext, 30, mybuffer, samplelen)
- sensor.printGraph(threshContext, 5)
-# if(thresh):
-# print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq5.py b/peripheral/libupm/examples/python/mq5.py
deleted file mode 100644
index 5e7deb8..0000000
--- a/peripheral/libupm/examples/python/mq5.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGas
-
-# Attach gas sensor to AIO0
-myMQ5 = upmGas.MQ5(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMQ5
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGas.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of dots as averages
-mybuffer = upmGas.uint16Array(128)
-while(1):
- samplelen = myMQ5.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = myMQ5.findThreshold(threshContext, 30, mybuffer, samplelen)
- myMQ5.printGraph(threshContext, 5)
- if(thresh):
- print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq6.py b/peripheral/libupm/examples/python/mq6.py
deleted file mode 100644
index 8788e23..0000000
--- a/peripheral/libupm/examples/python/mq6.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGAS
-
-# Attach gas sensor to Analog A0
-sensor = upmGAS.MQ6(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from sensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGAS.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of asteriskss as averages
-mybuffer = upmGAS.uint16Array(128)
-while(1):
- samplelen = sensor.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = sensor.findThreshold(threshContext, 30, mybuffer, samplelen)
- sensor.printGraph(threshContext, 5)
-# if(thresh):
-# print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq7.py b/peripheral/libupm/examples/python/mq7.py
deleted file mode 100644
index 62a9056..0000000
--- a/peripheral/libupm/examples/python/mq7.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGAS
-
-# Attach gas sensor to Analog A0
-sensor = upmGAS.MQ7(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from sensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGAS.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of asteriskss as averages
-mybuffer = upmGAS.uint16Array(128)
-while(1):
- samplelen = sensor.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = sensor.findThreshold(threshContext, 30, mybuffer, samplelen)
- sensor.printGraph(threshContext, 5)
-# if(thresh):
-# print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq8.py b/peripheral/libupm/examples/python/mq8.py
deleted file mode 100644
index 5380018..0000000
--- a/peripheral/libupm/examples/python/mq8.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGAS
-
-# Attach gas sensor to Analog A0
-sensor = upmGAS.MQ8(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from sensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGAS.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of asteriskss as averages
-mybuffer = upmGAS.uint16Array(128)
-while(1):
- samplelen = sensor.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = sensor.findThreshold(threshContext, 30, mybuffer, samplelen)
- sensor.printGraph(threshContext, 5)
-# if(thresh):
-# print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/mq9.py b/peripheral/libupm/examples/python/mq9.py
deleted file mode 100644
index f39cf39..0000000
--- a/peripheral/libupm/examples/python/mq9.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_gas as upmGas
-
-# Attach gas sensor to AIO0
-myMQ9 = upmGas.MQ9(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myMQ9
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-threshContext = upmGas.thresholdContext()
-threshContext.averageReading = 0
-threshContext.runningAverage = 0
-threshContext.averagedOver = 2
-
-# Infinite loop, ends when script is cancelled
-# Repeatedly, take a sample every 2 microseconds;
-# find the average of 128 samples; and
-# print a running graph of dots as averages
-mybuffer = upmGas.uint16Array(128)
-while(1):
- samplelen = myMQ9.getSampledWindow(2, 128, mybuffer)
- if samplelen:
- thresh = myMQ9.findThreshold(threshContext, 30, mybuffer, samplelen)
- myMQ9.printGraph(threshContext, 5)
- if(thresh):
- print "Threshold is ", thresh
diff --git a/peripheral/libupm/examples/python/nlgpio16.py b/peripheral/libupm/examples/python/nlgpio16.py
deleted file mode 100644
index 7be815d..0000000
--- a/peripheral/libupm/examples/python/nlgpio16.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import sys, signal, atexit
-import pyupm_nlgpio16 as sensorObj
-
-# Instantiate a NLGPIO16 Module on the default UART (/dev/ttyACM0)
-sensor = sensorObj.NLGPIO16()
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# get the Version
-print "Device Version:", sensor.getVersion()
-# read the gpio at pin 3
-print "GPIO 3 Value:", sensor.gpioRead(3)
-# read the analog voltage at pin 5
-print "Analog 5 Voltage:", sensor.analogReadVolts(5)
-# set the gpio at pin 14 to HIGH
-sensor.gpioSet(14)
diff --git a/peripheral/libupm/examples/python/nunchuck.py b/peripheral/libupm/examples/python/nunchuck.py
deleted file mode 100644
index f7bc261..0000000
--- a/peripheral/libupm/examples/python/nunchuck.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_nunchuck as upmNunchuck
-
-# Instantiate a nunchuck controller bus 0 on I2C
-myNunchuck = upmNunchuck.NUNCHUCK(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myNunchuck
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# always do this first
-print "Initializing... "
-if (not myNunchuck.init()):
- print "nunchuck->init() failed."
- sys.exit(0);
-
-def buttonStateStr(buttonState):
- return "pressed" if buttonState else "not pressed"
-
-# Print the X and Y input values every second
-while(1):
- myNunchuck.update()
-
- outputStr = "stickX: {0}, stickY: {1}".format(
- myNunchuck.stickX, myNunchuck.stickY)
- print outputStr
- outputStr = "accelX: {0}, accelY: {1}, accelZ: {2}".format(
- myNunchuck.accelX, myNunchuck.accelY, myNunchuck.accelZ)
- print outputStr
-
- outputStr = "button C: {0}".format(
- buttonStateStr(myNunchuck.buttonC))
- print outputStr
- outputStr = "button Z: {0}".format(
- buttonStateStr(myNunchuck.buttonZ))
- print outputStr
-
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/oled_ssd1308.py b/peripheral/libupm/examples/python/oled_ssd1308.py
deleted file mode 100644
index 9ea1443..0000000
--- a/peripheral/libupm/examples/python/oled_ssd1308.py
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-# Load i2clcd display module
-import time, signal, sys
-import pyupm_i2clcd as upmLCD
-
-myLCD = upmLCD.SSD1308(0, 0x3C);
-
-logoArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 192, 192, 192, 224,
-224, 224, 224, 240, 240, 248, 248, 120, 120, 120, 120, 60, 60, 60, 60, 60,
-62, 30, 30, 30, 30, 30, 30, 30, 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31,
-30, 62, 62, 62, 62, 126, 126, 124, 124, 252, 252, 248, 248, 240, 240, 240,
-224, 224, 224, 192, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
-128, 0, 56, 56, 28, 30, 14, 15, 15, 7, 7, 7, 7, 3, 3, 1, 1, 1, 1, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-192, 192, 192, 192, 192, 192, 192, 192, 0, 0, 0, 0, 192, 193, 195, 195,
-195, 7, 15, 15, 63, 127, 255, 255, 255, 254, 252, 252, 240, 192, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 192, 192, 240, 248, 124, 124, 60, 0, 0, 0, 0, 159, 159,
-159, 159, 159, 159, 159, 159, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128,
-128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0,
-0, 0, 0, 0, 254, 254, 254, 254, 254, 254, 254, 254, 128, 128, 128, 128,
-128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 192, 192, 192, 192, 192, 192, 128,
-128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
-0, 0, 0, 0, 3, 7, 3, 3, 3, 0, 0, 0, 0, 0, 1, 1, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 224, 248, 252, 252, 255, 127, 15, 15, 3, 1, 0, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 15, 15, 15, 15, 15, 15, 255, 255, 255, 255, 255,
-255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 15, 15,
-15, 15, 15, 224, 224, 252, 254, 255, 255, 255, 255, 159, 159, 143, 143,
-135, 135, 143, 159, 255, 255, 255, 255, 255, 255, 252, 248, 0, 0, 0, 255,
-255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
-224, 248, 248, 255, 255, 255, 255, 255, 127, 15, 255, 255, 255, 255, 255,
-255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
-255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0,
-0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255,
-255, 255, 255, 255, 255, 192, 192, 192, 192, 192, 31, 31, 255, 255, 255,
-255, 255, 255, 231, 231, 199, 199, 199, 199, 199, 199, 199, 199, 231, 231,
-231, 231, 199, 135, 0, 0, 0, 63, 255, 255, 255, 255, 255, 255, 255, 0, 0,
-0, 0, 224, 240, 248, 248, 252, 254, 255, 255, 255, 127, 63, 63, 31, 15, 7,
-7, 1, 0, 0, 63, 63, 255, 255, 255, 255, 255, 240, 192, 192, 128, 0, 0, 0,
-0, 0, 0, 0, 0, 1, 3, 3, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7,
-0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 3, 3, 7, 7, 7,
-7, 7, 7, 7, 7, 7, 0, 0, 0, 1, 3, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 7, 7, 7,
-7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 1, 3, 3, 7, 135, 135, 135, 192, 192, 0, 0, 7,
-7, 3, 3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15,
-31, 127, 127, 127, 255, 255, 252, 252, 252, 248, 240, 240, 240, 224, 224,
-224, 192, 192, 192, 192, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192,
-224, 224, 224, 224, 240, 240, 240, 240, 248, 248, 248, 248, 252, 252, 252,
-254, 254, 255, 255, 255, 255, 255, 255, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-3, 3, 3, 7, 7, 7, 15, 15, 31, 31, 31, 63, 63, 63, 63, 63, 127, 127, 127,
-127, 127, 255, 255, 255, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-255, 255, 255, 255, 255, 255, 255, 127, 127, 127, 127, 127, 127, 127, 127,
-63, 63, 63, 63, 63, 31, 31, 31, 31, 31, 15, 15, 15, 15, 7, 7, 7, 7, 3, 3,
-3, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0]
-
-intelLogo = upmLCD.uint8Array(len(logoArr))
-
-for x in range(len(logoArr)):
- intelLogo.__setitem__(x, logoArr[x])
-myLCD.clear()
-myLCD.draw(intelLogo, 1024)
-
-del intelLogo
-del myLCD
-print "Exiting"
diff --git a/peripheral/libupm/examples/python/oled_ssd1327.py b/peripheral/libupm/examples/python/oled_ssd1327.py
deleted file mode 100644
index be19a95..0000000
--- a/peripheral/libupm/examples/python/oled_ssd1327.py
+++ /dev/null
@@ -1,189 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-# Load i2clcd display module
-import time, signal, sys
-import pyupm_i2clcd as upmLCD
-
-myLCD = upmLCD.SSD1327(0, 0x3C);
-
-logoArr = [0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x07, 0x80, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xC0,
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
-0x07, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x20, 0x0F, 0x80, 0x01, 0xE0,
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
-0x0F, 0x00, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
-0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
-0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
-0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0,
-0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
-0x0F, 0x80, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x01, 0xE0,
-0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E,
-0x0F, 0x80, 0x03, 0xE0, 0x78, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1E, 0x07, 0x80, 0x03, 0xE0,
-0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
-0x07, 0x80, 0x03, 0xE0, 0xF0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x1F, 0x07, 0x80, 0x03, 0xC1,
-0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
-0x87, 0xC0, 0x07, 0xC1, 0xF0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x0F, 0x83, 0xC0, 0x07, 0x83,
-0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
-0xC3, 0xC0, 0x07, 0x87, 0xE0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x07, 0xE1, 0xE0, 0x07, 0x0F,
-0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
-0xF0, 0xE0, 0x0F, 0x0F, 0x80, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0xF8, 0xF0, 0x0E, 0x1F,
-0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-0xF8, 0x70, 0x1C, 0x3F, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x18, 0x7E,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7F, 0x18, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1F, 0x88, 0x21, 0xF0,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0F, 0xC4, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x03, 0xE0, 0x0F, 0x80,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0xF8, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
-0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x6C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06,
-0x00, 0x00, 0x60, 0x00, 0x7E, 0x3F, 0x0F, 0xC3,
-0xF0, 0xFA, 0x0F, 0xDF, 0xE1, 0x9F, 0xEC, 0x7E,
-0xE6, 0x73, 0x9C, 0xE7, 0x39, 0xCE, 0x1C, 0xDF,
-0xE1, 0xB9, 0xEC, 0xE7, 0xE0, 0x61, 0xD8, 0x66,
-0x1B, 0x86, 0x1C, 0x06, 0x61, 0xB0, 0x6D, 0xC3,
-0x7C, 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x0F, 0x86,
-0x61, 0xB0, 0x6D, 0x83, 0x3E, 0x7F, 0xFF, 0xFF,
-0xFF, 0x06, 0x07, 0xC6, 0x61, 0xB0, 0x6D, 0x83,
-0xC3, 0x61, 0x18, 0x46, 0x03, 0x86, 0x18, 0x66,
-0x61, 0xB0, 0x6D, 0xC3, 0xFE, 0x7F, 0x9F, 0xE7,
-0xF9, 0xFE, 0x1F, 0xE6, 0x3F, 0x9F, 0xEC, 0xFE,
-0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xC6,
-0x3F, 0x9F, 0xEC, 0x7E, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00,
-0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x44, 0x00, 0x00, 0x20, 0x82, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0xF3,
-0xCF, 0x70, 0x9E, 0x79, 0xE7, 0x80, 0x00, 0x00,
-0x00, 0x00, 0x7D, 0x9E, 0x68, 0x20, 0xB2, 0xC8,
-0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9E,
-0x6F, 0x20, 0xB2, 0xF9, 0xE7, 0x80, 0x00, 0x00,
-0x00, 0x00, 0x46, 0x9A, 0x61, 0x20, 0xB2, 0xCB,
-0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xF3,
-0xCF, 0x30, 0x9E, 0x79, 0xE7, 0x90, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x7C, 0x02, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00,
-0xF8, 0x00, 0x00, 0x40, 0x40, 0x02, 0x00, 0x00,
-0x83, 0x60, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x40,
-0x60, 0xB7, 0x79, 0xE7, 0x81, 0xC7, 0x92, 0x70,
-0x89, 0xE7, 0x9E, 0x78, 0x7C, 0xE2, 0xC9, 0x2C,
-0x81, 0xCC, 0xD2, 0x40, 0xFB, 0x21, 0xB2, 0x48,
-0x40, 0x62, 0xF9, 0x2C, 0x80, 0x8C, 0xD2, 0x40,
-0x8B, 0xE7, 0xB0, 0x48, 0x40, 0xE2, 0xC9, 0x2C,
-0x80, 0x84, 0xD2, 0x40, 0x8B, 0x2D, 0x92, 0x48,
-0x7D, 0xB3, 0x79, 0x27, 0x80, 0x87, 0x9E, 0x40,
-0x8D, 0xE7, 0x9E, 0x48, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
-
-SeeedLogo = upmLCD.uint8Array(len(logoArr))
-
-for x in range(len(logoArr)):
- SeeedLogo.__setitem__(x, logoArr[x])
-
-# If you don't set the display to be white, the seeed logo will appear jagged
-myLCD.setGrayLevel(12)
-myLCD.draw(SeeedLogo, 96 * 96 / 8);
-
-for i in range(12):
- myLCD.setCursor(i, 0)
- myLCD.setGrayLevel(i)
- myLCD.write('Hello World')
-
-print "Exiting"
diff --git a/peripheral/libupm/examples/python/otp538u.py b/peripheral/libupm/examples/python/otp538u.py
deleted file mode 100644
index a7713b1..0000000
--- a/peripheral/libupm/examples/python/otp538u.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_otp538u as upmOtp538u
-
-# analog voltage, usually 3.3 or 5.0
-OTP538U_AREF = 5.0
-
-# Instantiate a OTP538U on analog pins A0 and A1
-# A0 is used for the Ambient Temperature and A1 is used for the
-# Object temperature.
-myTempIR = upmOtp538u.OTP538U(0, 1, OTP538U_AREF)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit, including functions from myTempIR
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- outputStr = ("Ambient temp: {0}"
- " C, Object temp: {1}"
- " C".format(myTempIR.ambientTemperature(),
- myTempIR.objectTemperature()))
- print outputStr
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ozw.py b/peripheral/libupm/examples/python/ozw.py
deleted file mode 100644
index 010c1fc..0000000
--- a/peripheral/libupm/examples/python/ozw.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ozw as sensorObj
-
-# Instantiate an OZW instance
-sensor = sensorObj.OZW()
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-
-defaultDev = "/dev/ttyACM0"
-if (len(sys.argv) > 1):
- defaultDev = sys.argv[1]
-
-# The first thing to do is create options, then lock them when done.
-sensor.optionsCreate()
-sensor.optionsLock()
-
-# Next, initialize it.
-print "Initializing, this may take awhile depending on your ZWave network"
-
-if (not sensor.init(defaultDev)):
- print "Init failed."
- sys.exit(1)
-
-print "Initialization complete"
-
-print "Dumping nodes..."
-
-sensor.dumpNodes()
-
-# The following is example output of dumpNodes:
-#
-# Dumping nodes...
-# Node 1: Z-Stick Gen5
-# Node 2: Smart Switch 6
-# Index: 0, Type: bool, Label: Switch, Value: False
-# Index: 2, Type: float, Label: Energy, Value: 1.190 kWh
-# Index: 3, Type: float, Label: Previous Reading, Value: 1.190 kWh
-# Index: 4, Type: int32, Label: Interval, Value: 1521 seconds
-# Index: 5, Type: float, Label: Power, Value: 0.000 W
-# Index: 6, Type: float, Label: Voltage, Value: 121.256 V
-# Index: 7, Type: float, Label: Current, Value: 0.000 A
-# Index: 8, Type: bool, Label: Exporting, Value: False
-# Index: 45, Type: list, Label: Day, Value: Friday
-# Index: 46, Type: byte, Label: Hour, Value: 5
-# Index: 47, Type: byte, Label: Minute, Value: 53
-# Node 3: Multi Sensor
-# Index: 0, Type: bool, Label: Sensor, Value: True
-# Index: 1, Type: float, Label: Temperature, Value: 72.8 F
-# Index: 2, Type: float, Label: Luminance, Value: 4 lux
-# Index: 3, Type: float, Label: Relative Humidity, Value: 22 %
-# Index: 17, Type: byte, Label: Battery Level, Value: 98 %
-# Node 5: Minimote
-# Node 6: Smart Energy Switch
-# Index: 0, Type: bool, Label: Switch, Value: False
-# Index: 2, Type: float, Label: Power, Value: 0.000 W
-# Index: 3, Type: float, Label: Energy, Value: 1.609 kWh
-# Index: 4, Type: float, Label: Previous Reading, Value: 1.609 kWh
-# Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
-# Index: 6, Type: float, Label: Power, Value: 0.000 W
-# Index: 7, Type: float, Label: Previous Reading, Value: 1.609 W
-# Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
-# Index: 9, Type: bool, Label: Exporting, Value: False
-# Node 7: Smart Energy Switch
-# Index: 0, Type: bool, Label: Switch, Value: False
-# Index: 2, Type: float, Label: Power, Value: 0.000 W
-# Index: 3, Type: float, Label: Energy, Value: 0.000 kWh
-# Index: 4, Type: float, Label: Previous Reading, Value: 0.000 kWh
-# Index: 5, Type: int32, Label: Interval, Value: 1521 seconds
-# Index: 6, Type: float, Label: Power, Value: 0.000 W
-# Index: 7, Type: float, Label: Previous Reading, Value: 0.000 W
-# Index: 8, Type: int32, Label: Interval, Value: 1521 seconds
-# Index: 9, Type: bool, Label: Exporting, Value: False
-#
-# So, with the above in mind:
-#
-# 1. Query the temperature on node 3 and print it out (as a
-# string), along with the units of measure:
-#
-# print "Temperature:", sensor.getValueAsString(3, 1),
-# sensor->getValueUnits(3, 1)
-#
-# 2. query the same temperature as a float:
-#
-# temperature = sensor.getValueAsFloat(3, 1)
-#
-# 3. Turn on the light plugged into the switch on Node 7, wait 5
-# seconds, then turn it back off again:
-#
-# print "Turning ON node 7"
-# sensor.setValueAsBool(7, 0, true)
-#
-# print "Sleeping for 5 seconds";
-# time.sleep(5)
-#
-# print "Turning OFF node 7"
-# sensor.setValueAsBool(7, 0, false);
-
diff --git a/peripheral/libupm/examples/python/pn532-writeurl.py b/peripheral/libupm/examples/python/pn532-writeurl.py
deleted file mode 100644
index b3abc41..0000000
--- a/peripheral/libupm/examples/python/pn532-writeurl.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_pn532 as upmPn532
-
-# Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
-# IRQ, and gpio 2 for the reset pin.
-myNFC = upmPn532.PN532(3, 2)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-if (not myNFC.init()):
- print "init() failed"
- sys.exit(0)
-
-vers = myNFC.getFirmwareVersion()
-
-if (vers):
- print "Got firmware version: %08x" % vers
-else:
- print "Could not identify PN532"
- sys.exit(0)
-
-# Now scan and identify any cards that come in range (1 for now)
-
-# Retry forever
-myNFC.setPassiveActivationRetries(0xff)
-
-myNFC.SAMConfig()
-
-uidSize = upmPn532.uint8Array(0)
-uid = upmPn532.uint8Array(7)
-
-# the URL we want to add as an NDEF record
-# NOTE: this cannot exceed 34 characters.
-url = "iotdk.intel.com"
-
-foundCard = False
-
-while (not foundCard):
- for i in range(7):
- uid.__setitem__(i, 0)
- if (myNFC.readPassiveTargetID(upmPn532.PN532.BAUD_MIFARE_ISO14443A,
- uid, uidSize, 2000)):
- # found a card
- print "Found a card: UID len", uidSize.__getitem__(0)
- print "UID: ",
- for i in range(uidSize.__getitem__(0)):
- print "%02x" % uid.__getitem__(i),
- print
- print "SAK: %02x" % myNFC.getSAK()
- print "ATQA: %04x" % myNFC.getATQA()
- print
- foundCard = True
- else:
- print "Waiting for a card...\n"
-
-if (uidSize.__getitem__(0) != 7):
- print "This example will only write an NDEF URI to preformatted"
- print "Mifare Ultralight or NTAG2XX tags"
- sys.exit(1)
-
-# 48 bytes is maximum data area on ultralight cards, so we use that
-# as the maximum datasize here. Obviously if you have a bigger
-# card, you can write more data.
-if (not myNFC.ntag2xx_WriteNDEFURI(upmPn532.PN532.NDEF_URIPREFIX_HTTP, url, 48)):
- # failure
- print "Failed to write NDEF record tag."
- sys.exit(1)
-
-print "Success, URL record written to tag."
diff --git a/peripheral/libupm/examples/python/pn532.py b/peripheral/libupm/examples/python/pn532.py
deleted file mode 100644
index bb000d4..0000000
--- a/peripheral/libupm/examples/python/pn532.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_pn532 as upmPn532
-
-# Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the
-# IRQ, and gpio 2 for the reset pin.
-myNFC = upmPn532.PN532(3, 2)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-if (not myNFC.init()):
- print "init() failed"
- sys.exit(0)
-
-vers = myNFC.getFirmwareVersion()
-
-if (vers):
- print "Got firmware version: %08x" % vers
-else:
- print "Could not identify PN532"
- sys.exit(0)
-
-# Now scan and identify any cards that come in range (1 for now)
-
-# Retry forever
-myNFC.setPassiveActivationRetries(0xff)
-
-myNFC.SAMConfig()
-
-uidSize = upmPn532.uint8Array(0)
-uid = upmPn532.uint8Array(7)
-
-
-while (1):
- for i in range(7):
- uid.__setitem__(i, 0)
- if (myNFC.readPassiveTargetID(upmPn532.PN532.BAUD_MIFARE_ISO14443A,
- uid, uidSize, 2000)):
- # found a card
- print "Found a card: UID len", uidSize.__getitem__(0)
- print "UID: ",
- for i in range(uidSize.__getitem__(0)):
- print "%02x" % uid.__getitem__(i),
- print
- print "SAK: %02x" % myNFC.getSAK()
- print "ATQA: %04x" % myNFC.getATQA()
- print
- time.sleep(1)
- else:
- print "Waiting for a card...\n"
diff --git a/peripheral/libupm/examples/python/ppd42ns.py b/peripheral/libupm/examples/python/ppd42ns.py
deleted file mode 100644
index 86e037d..0000000
--- a/peripheral/libupm/examples/python/ppd42ns.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ppd42ns as upmPpd42ns
-
-# Instantiate a dust sensor on digital pin D8
-myDustSensor = upmPpd42ns.PPD42NS(8)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myDustSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-notice = ("This program will give readings "
-"every 30 seconds until you stop it")
-print notice
-
-while(1):
- data = myDustSensor.getData()
- # we need to sleep for a bit for the data to print out
- time.sleep(.1)
- print "Low pulse occupancy: " + str(data.lowPulseOccupancy)
- print "Ratio: " + str(data.ratio)
- print "Concentration: " + str(data.concentration)
diff --git a/peripheral/libupm/examples/python/rfr359f.py b/peripheral/libupm/examples/python/rfr359f.py
deleted file mode 100644
index 349821d..0000000
--- a/peripheral/libupm/examples/python/rfr359f.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_rfr359f as upmRfr359f
-
-# Instantiate an RFR359F digital pin D2
-# This was tested on the Grove IR Distance Interrupter
-myDistInterrupter = upmRfr359f.RFR359F(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myDistInterrupter
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myDistInterrupter.objectDetected()):
- print "Object detected"
- else:
- print "Area is clear"
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/rgbringcoder.py b/peripheral/libupm/examples/python/rgbringcoder.py
deleted file mode 100644
index 5c0b1fb..0000000
--- a/peripheral/libupm/examples/python/rgbringcoder.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_rgbringcoder as upmRGBRingCoder
-
-# There are a lot of pins to hook up. These pins are valid for the
-# Edison board, but may need to be adjusted for other platforms.
-
-# In order:
-# enable - 4
-# latch - 10
-# clear - 11
-# clock - 2
-# data - 9
-# switch - 7
-
-# red pwm - 3
-# green pwm - 5
-# blue pwm - 6
-
-# encA - 12
-# encB - 13
-ringCoder = upmRGBRingCoder.RGBRingCoder(4, 10, 11, 2, 9, 7, 12, 13, 3,
- 5, 6)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from ringCoder
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-spin = 0x0001;
-oldState = False;
-oldPos = 0;
-
-# Lets go green
-ringCoder.setRGBLED(0.99, 0.01, 0.99);
-
-while(1):
- # you spin me round...
- if ((spin & 0xffff) == 0):
- spin = 0x0001
-
- ringCoder.setRingLEDS(spin)
- spin <<= 1
-
- # check button state
- bstate = ringCoder.getButtonState()
- if (bstate != oldState):
- print "Button state changed from", oldState, " to ", bstate
- oldState = bstate
-
- # check encoder position
- epos = ringCoder.getEncoderPosition()
- if (epos != oldPos):
- print "Encoder position changed from", oldPos, "to", epos
- oldPos = epos
-
- time.sleep(0.1)
diff --git a/peripheral/libupm/examples/python/rhusb.py b/peripheral/libupm/examples/python/rhusb.py
deleted file mode 100644
index 70198e0..0000000
--- a/peripheral/libupm/examples/python/rhusb.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2016 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_rhusb as sensorObj
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting..."
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-defaultDev = "/dev/ttyUSB0"
-
-# if an argument was specified, use it as the device instead
-if (len(sys.argv) > 1):
- defaultDev = sys.argv[1]
-
-print "Using device", defaultDev
-print "Initializing..."
-
-# Instantiate an RHUSB instance on defaultDev
-sensor = sensorObj.RHUSB(defaultDev)
-
-# output the firmware ID
-print "Firmware ID:", sensor.getFirmwareID()
-print
-
-# update and print available values every second
-while (1):
- # update our values from the sensor
- sensor.update()
-
- # we show both C and F for temperature
- print "Temperature:", sensor.getTemperature(), "C /",
- print sensor.getTemperature(True), "F"
-
- print "Humidity:", sensor.getHumidity(), "%"
-
- print
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/rotaryencoder.py b/peripheral/libupm/examples/python/rotaryencoder.py
deleted file mode 100644
index 89738fd..0000000
--- a/peripheral/libupm/examples/python/rotaryencoder.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_rotaryencoder as upmRotaryEncoder
-
-# Instantiate a Grove Rotary Encoder, using signal pins D2 and D3
-myRotaryEncoder = upmRotaryEncoder.RotaryEncoder(2, 3);
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myRotaryEncoder
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# Read the value every second and detect motion
-while(1):
- print "Position: {0}".format(myRotaryEncoder.position())
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/rpr220.py b/peripheral/libupm/examples/python/rpr220.py
deleted file mode 100644
index edf14ca..0000000
--- a/peripheral/libupm/examples/python/rpr220.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_rpr220 as upmRpr220
-
-# This example uses a simple method to determine current status
-
-# Instantiate an RPR220 digital pin D2
-# This was tested on the Grove IR Reflective Sensor
-myReflectiveSensor = upmRpr220.RPR220(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myReflectiveSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myReflectiveSensor.blackDetected()):
- print "Black detected"
- else:
- print "Black NOT detected"
-
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/sainsmartks.py b/peripheral/libupm/examples/python/sainsmartks.py
deleted file mode 100644
index 7763de9..0000000
--- a/peripheral/libupm/examples/python/sainsmartks.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_i2clcd as sainsmartObj
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from ringCoder
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Instantiate a Sainsmart LCD Keypad Shield using default pins
-lcd = sainsmartObj.SAINSMARTKS()
-
-lcd.setCursor(0,0)
-lcd.write("Sainsmart KS")
-lcd.setCursor(1,2)
-lcd.write("Hello World")
-
-# output current key value every second.
-while(1):
- print "Button value: ", lcd.getRawKeyValue()
- time.sleep(1)
-
diff --git a/peripheral/libupm/examples/python/si114x.py b/peripheral/libupm/examples/python/si114x.py
deleted file mode 100644
index 4264620..0000000
--- a/peripheral/libupm/examples/python/si114x.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_si114x as upmSi114x
-
-# Instantiate a SI114x UV Sensor on I2C bus 0
-myUVSensor = upmSi114x.SI114X(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myUVSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# First initialize it
-myUVSensor.initialize()
-
-print "UV Index Scale:"
-print "---------------"
-print "11+ Extreme"
-print "8-10 Very High"
-print "6-7 High"
-print "3-5 Moderate"
-print "0-2 Low\n"
-
-# update every second and print the currently measured UV Index
-while (1):
- # update current value(s)
- myUVSensor.update()
-
- # print detected value
- print "UV Index:", myUVSensor.getUVIndex()
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/sm130.py b/peripheral/libupm/examples/python/sm130.py
deleted file mode 100644
index ce6ae1b..0000000
--- a/peripheral/libupm/examples/python/sm130.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_sm130 as sensorObj
-
-# Instantiate a UART based SM130 RFID Module using defaults
-sensor = sensorObj.SM130()
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Set the baud rate, 19200 baud is the default.
-if (sensor.setBaudRate(19200)):
- print "Failed to set baud rate"
- sys.exit(0)
-
-print "Resetting..."
-sensor.reset()
-
-print "Firmware revision: " + sensor.getFirmwareVersion()
-
-print "Waiting up to 5 seconds for a tag..."
-
-if (sensor.waitForTag(5000)):
- print "Found tag, UID:",
- print sensor.string2HexString(sensor.getUID())
- print "Tag Type:",
- print sensor.tag2String(sensor.getTagType())
-else:
- # error
- print "waitForTag failed: " + sensor.getLastErrorString()
diff --git a/peripheral/libupm/examples/python/stepmotor.py b/peripheral/libupm/examples/python/stepmotor.py
deleted file mode 100644
index 125ac71..0000000
--- a/peripheral/libupm/examples/python/stepmotor.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/python
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_stepmotor as mylib
-
-# Instantiate a StepMotor object on pins 2 (dir) and 3 (step)
-stepper = mylib.StepMotor(2, 3)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-print "Rotating 1 revolution forward and back at 60 rpm."
-stepper.setSpeed(60)
-stepper.stepForward(200)
-time.sleep(1)
-stepper.stepBackward(200)
-time.sleep(1)
-
-print "Rotating 1 revolution forward and back at 150 rpm."
-stepper.setSpeed(150)
-stepper.stepForward(200)
-time.sleep(1)
-stepper.stepBackward(200)
-time.sleep(1)
-
-print "Rotating 1 revolution forward and back at 300 rpm."
-stepper.setSpeed(300)
-stepper.stepForward(200)
-time.sleep(1)
-stepper.stepBackward(200)
-time.sleep(1)
diff --git a/peripheral/libupm/examples/python/sx1276-fsk.py b/peripheral/libupm/examples/python/sx1276-fsk.py
deleted file mode 100644
index 6899699..0000000
--- a/peripheral/libupm/examples/python/sx1276-fsk.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_sx1276 as sensorObj
-
-# Instantiate an SX1276 using default parameters
-sensor = sensorObj.SX1276()
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-print "Specify an argument to go into receive mode. Default is transmit"
-
-# 915Mhz
-sensor.setChannel(915000000)
-
-# FSK configuration (rx and tx must be configured the same):
-# Tx output power = 14 dBm
-# FSK freq deviation = 25000 Hz
-# FSK bandwidth = 50000 bps
-# FSK AFC bandwidth = 83333 Hz
-# FSK datarate = 50000 bps
-# FSK preamble len = 5
-# FSK fixed length payload = false
-# FSK CRC check = true
-# FSK (rx) continuous Rx mode = False
-
-sensor.setTxConfig(sensor.MODEM_FSK, 14, 25000, 0,
- 50000, 0, 5, False, True, False, 0, False)
-
-sensor.setRxConfig(sensor.MODEM_FSK, 50000, 50000,
- 0, 83333, 5, 0, False, 0, True,
- False, 0, False, True)
-
-count = 0
-
-while True:
- if (len(sys.argv) > 1):
- # receive mode
- print "Attempting to receive..."
- rv = sensor.setRx(3000)
- if (rv):
- print "setRx returned ", rv
- else:
- print "Received Buffer: ", sensor.getRxBufferStr();
- # go back to sleep when done
-
- sensor.setSleep()
- time.sleep(.25)
- else:
- # transmit mode
- buffer = "Ping " + str(count)
- count += 1
- print "Sending..." + buffer
- sensor.sendStr(buffer, 3000)
- sensor.setSleep();
- time.sleep(1);
diff --git a/peripheral/libupm/examples/python/sx1276-lora.py b/peripheral/libupm/examples/python/sx1276-lora.py
deleted file mode 100644
index 05d9700..0000000
--- a/peripheral/libupm/examples/python/sx1276-lora.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_sx1276 as sensorObj
-
-# Instantiate an SX1276 using default parameters
-sensor = sensorObj.SX1276()
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-print "Specify an argument to go into receive mode. Default is transmit"
-
-# 915Mhz
-sensor.setChannel(915000000)
-
-# LORA configuration (rx and tx must be configured the same):
-# Tx output power = 14 dBm
-# LORA bandwidth = 125000 (can also be 250K and 500K)
-# LORA spreading factor = 7
-# LORA coding rate = 1 (4/5)
-# LORA preamble len = 8
-# LORA symbol timeout = 5
-# LORA fixed payload = false
-# LORA IQ inversion = false
-# LORA (rx) continuous Rx mode = true
-
-sensor.setTxConfig(sensor.MODEM_LORA, 14, 0, 125000,
- 7, 1, 8, False, True, False, 0, False)
-
-sensor.setRxConfig(sensor.MODEM_LORA, 125000, 7,
- 1, 0, 8, 5, False, 0, True, False, 0, False, True)
-
-count = 0
-
-while True:
- if (len(sys.argv) > 1):
- # receive mode
- print "Attempting to receive..."
- rv = sensor.setRx(3000)
- if (rv):
- print "setRx returned ", rv
- else:
- print "Received Buffer: ", sensor.getRxBufferStr();
- # go back to sleep when done
-
- sensor.setSleep()
- time.sleep(.25)
- else:
- # transmit mode
- buffer = "Ping " + str(count)
- count += 1
- print "Sending..." + buffer
- sensor.sendStr(buffer, 3000)
- sensor.setSleep();
- time.sleep(1);
diff --git a/peripheral/libupm/examples/python/sx6119.py b/peripheral/libupm/examples/python/sx6119.py
deleted file mode 100644
index a849836..0000000
--- a/peripheral/libupm/examples/python/sx6119.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import sys
-import pyupm_sx6119 as upmSx6119
-
-# Instantiate a SX6119 on digital pins 2 (power) and 3 (seek)
-# This example was tested on the Grove FM Receiver.
-myFM_receiver_obj = upmSx6119.SX6119(2, 3)
-
-# if an argument was specified (any argument), seek to the next
-# station, else just toggle the power.
-
-print "Supply any argument to the command line to seek to the"
-print "next station."
-print "Running the example without an argument will toggle the"
-print "power on or off.\n"
-
-doSeek = False
-
-if (len(sys.argv) > 1):
- doSeek = True
-
-# depending on what was selected, do it
-if (doSeek):
- myFM_receiver_obj.seek()
-else:
- myFM_receiver_obj.togglePower()
-
-print "Exiting";
diff --git a/peripheral/libupm/examples/python/t3311.py b/peripheral/libupm/examples/python/t3311.py
deleted file mode 100644
index 0c568df..0000000
--- a/peripheral/libupm/examples/python/t3311.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2016 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_t3311 as sensorObj
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-defaultDev = "/dev/ttyUSB0"
-
-# if an argument was specified, use it as the device instead
-if (len(sys.argv) > 1):
- defaultDev = sys.argv[1]
-
-print "Initializing..."
-
-# Instantiate an T3311 instance, using MODBUS slave address 1, and
-# default comm parameters (9600, 8, N, 2)
-sensor = sensorObj.T3311(defaultDev, 1)
-
-# output the serial number and firmware revision
-print "Serial Number:", sensor.getSerialNumber()
-print "Firmware Revision: {0}.{1}".format(sensor.getFirmwareMajor(),
- sensor.getFirmwareMinor())
-print
-
-# update and print available values every second
-while (1):
- # update our values from the sensor
- sensor.update()
-
- # we show both C and F for temperature
- print "Temperature:", sensor.getTemperature(), "C /",
- print sensor.getTemperature(True), "F"
-
- print "Humidity:", sensor.getHumidity(), "%"
-
- # this value depends on the sensor configuration -- by default
- # it is the dew point temperature
- print "Computed Value:", sensor.getComputedValue()
-
- # with FW revisions > 2.44, extended computed data is available
- if (sensor.extendedDataAvailable()):
- print "Dew Point Temperature:", sensor.getDewPointTemperature(),
- print "C /", sensor.getDewPointTemperature(True), "F"
-
- print "Absolute Humidity:", sensor.getAbsoluteHumidity(), "g/m3"
-
- print "Specific Humidity:", sensor.getSpecificHumidity(),
- print "g/kg"
-
- print "Mixing Ratio:", sensor.getMixingRatio(), "g/kg"
-
- print "Specific Enthalpy:", sensor.getSpecificEnthalpy(),
- print "kJ/kg"
-
- print
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ta12200.py b/peripheral/libupm/examples/python/ta12200.py
deleted file mode 100644
index 7fce6ab..0000000
--- a/peripheral/libupm/examples/python/ta12200.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ta12200 as upmTa12200
-
-# Instantiate a TA12-200 sensor on analog pin A0
-myElectricitySensor = upmTa12200.TA12200(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myElectricitySensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# get the data every 50 milliseconds
-while(1):
- maxVal = myElectricitySensor.highestValue()
- current = myElectricitySensor.milliAmps(maxVal)
-
- outputStr = "Max ADC Value: %s, current: %smA" % (maxVal, current)
- print outputStr
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/tcs3414cs.py b/peripheral/libupm/examples/python/tcs3414cs.py
deleted file mode 100644
index 7b7fae0..0000000
--- a/peripheral/libupm/examples/python/tcs3414cs.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_tcs3414cs as upmTcs3414cs
-
-# Instantiate the color sensor on I2C
-myColorSensor = upmTcs3414cs.TCS3414CS()
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myColorSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-myrgb = upmTcs3414cs.tcs3414sc_rgb_t()
-
-# Print out the r, g, b, and clr value every 0.5 seconds
-while(1):
- myColorSensor.readRGB(myrgb)
- print "{0}, {1}, {2}, {3}".format(myrgb.r,
- myrgb.g, myrgb.b, myrgb.clr)
-
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/tm1637.py b/peripheral/libupm/examples/python/tm1637.py
deleted file mode 100644
index 8c75744..0000000
--- a/peripheral/libupm/examples/python/tm1637.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, signal
-import pyupm_tm1637 as tm1637
-
-# Register exit handler for normal Ctrl+C exit
-def SIGINTHandler(signum, frame):
- raise SystemExit
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Create a display object on pins 0 CLK and 1 DIO
-display = tm1637.TM1637(0, 1)
-dots = True
-
-# Get local time
-myTime = time.localtime(time.time())
-print time.strftime("System time: %H:%M", myTime)
-print ("You can adjust your time zone by setting the TZ environment variable.")
-
-# Draw a box for 3 seconds using 7-segment encoding
-display.write(0x39, 0x09, 0x09, 0x0f)
-time.sleep(3)
-
-# Loop indefinitely
-while True:
- # Update and display time
- timeString = time.strftime("%H%M", time.localtime(time.time()))
- display.write(timeString)
- # Toggle colon
- display.setColon(dots)
- dots = not dots
-
- # Sleep for 1 s
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/tp401.py b/peripheral/libupm/examples/python/tp401.py
deleted file mode 100644
index 5519508..0000000
--- a/peripheral/libupm/examples/python/tp401.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-from time import sleep
-import pyupm_gas as TP401
-
-# Give a qualitative meaning to the value from the sensor
-def airQuality(value):
- if(value < 50): return "Fresh Air"
- if(value < 200): return "Normal Indoor Air"
- if(value < 400): return "Low Pollution"
- if(value < 600): return "High Pollution - Action Recommended"
- return "Very High Pollution - Take Action Immediately"
-
-# New Grove Air Quality Sensor on AIO pin 0
-airSensor = TP401.TP401(0)
-
-# Wait for sensor to warm up
-print "Sensor is warming up for 3 minutes..."
-for i in range (1, 4):
- sleep(60)
- print i, "minute(s) passed."
-print "Sensor is ready!"
-
-# Loop indefinitely
-while True:
-
- # Read values (consecutive reads might vary slightly)
- value = airSensor.getSample()
- ppm = airSensor.getPPM()
-
- print "raw: %4d" % value , " ppm: %5.2f " % ppm , airQuality(value)
-
- # Sleep for 2.5 s
- sleep(2.5)
diff --git a/peripheral/libupm/examples/python/tsl2561.py b/peripheral/libupm/examples/python/tsl2561.py
deleted file mode 100644
index 35a3336..0000000
--- a/peripheral/libupm/examples/python/tsl2561.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_tsl2561 as upmTsl2561
-
-# Instantiate a digital light sensor TSL2561 on I2C
-myDigitalLightSensor = upmTsl2561.TSL2561()
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myDigitalLightSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- print "Light value is " + str(myDigitalLightSensor.getLux())
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/ttp223.py b/peripheral/libupm/examples/python/ttp223.py
deleted file mode 100644
index 7d1c847..0000000
--- a/peripheral/libupm/examples/python/ttp223.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# Author: Sarah Knepper <sarah.knepper@intel.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time
-import pyupm_ttp223 as ttp223
-
-# Create the TTP223 touch sensor object using GPIO pin 0
-touch = ttp223.TTP223(0)
-
-# Check whether or not a finger is near the touch sensor and
-# print accordingly, waiting one second between readings
-while 1:
- if touch.isPressed():
- print touch.name(), 'is pressed'
- else:
- print touch.name(), 'is not pressed'
- time.sleep(1)
-
-# Delete the touch sensor object
-del touch
diff --git a/peripheral/libupm/examples/python/ublox6.py b/peripheral/libupm/examples/python/ublox6.py
deleted file mode 100644
index bb98d2b..0000000
--- a/peripheral/libupm/examples/python/ublox6.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_ublox6 as upmUblox6
-
-# Instantiate a Ublox6 GPS device on uart 0.
-myGPSSensor = upmUblox6.Ublox6(0)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myGPSSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-if (not myGPSSensor.setupTty(upmUblox6.cvar.int_B9600)):
- print "Failed to setup tty port parameters"
- sys.exit(0)
-
-# Collect and output NMEA data.
-
-# This device also supports numerous configuration options, which
-# you can set with writeData(). Please refer to the Ublox-6 data
-# sheet for further information on the formats of the data sent and
-# received, and the various operating modes available.
-
-
-bufferLength = 256
-nmeaBuffer = upmUblox6.charArray(bufferLength)
-
-def getGPSInfo():
- # we don't want the read to block in this example, so always
- # check to see if data is available first.
- if (myGPSSensor.dataAvailable()):
- rv = myGPSSensor.readData(nmeaBuffer, bufferLength)
-
- numlines= 0
- if (rv > 0):
- GPSData = ""
- # read only the number of characters
- # specified by myGPSSensor.readData
- for x in range(rv):
- GPSData += nmeaBuffer.__getitem__(x)
- sys.stdout.write(GPSData)
-
- if (rv < 0): # some sort of read error occured
- print "Port read error."
- sys.exit(0)
-
-while (1):
- getGPSInfo()
- time.sleep(.1)
diff --git a/peripheral/libupm/examples/python/uln200xa.py b/peripheral/libupm/examples/python/uln200xa.py
deleted file mode 100644
index e926e46..0000000
--- a/peripheral/libupm/examples/python/uln200xa.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-import time, sys, signal, atexit
-import pyupm_uln200xa as upmULN200XA
-
-# Instantiate a Stepper motor on a ULN200XA Darlington Motor Driver
-# This was tested with the Grove Geared Step Motor with Driver
-
-# Instantiate a ULN2003XA stepper object
-myUln200xa = upmULN200XA.ULN200XA(4096, 8, 9, 10, 11)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This lets you run code on exit,
-# including functions from myUln200xa
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-myUln200xa.setSpeed(5) # 5 RPMs
-myUln200xa.setDirection(upmULN200XA.ULN200XA.DIR_CW)
-
-print "Rotating 1 revolution clockwise."
-myUln200xa.stepperSteps(4096)
-
-print "Sleeping for 2 seconds..."
-time.sleep(2)
-
-print "Rotating 1/2 revolution counter clockwise."
-myUln200xa.setDirection(upmULN200XA.ULN200XA.DIR_CCW)
-myUln200xa.stepperSteps(2048)
-
-# release
-myUln200xa.release()
-
-# exitHandler is called automatically
diff --git a/peripheral/libupm/examples/python/urm37-uart.py b/peripheral/libupm/examples/python/urm37-uart.py
deleted file mode 100644
index 8e6ee80..0000000
--- a/peripheral/libupm/examples/python/urm37-uart.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_urm37 as sensorObj
-
-# Instantiate a URM37 sensor on UART 0, with the reset pin on D2
-sensor = sensorObj.URM37(0, 2)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Every half a second, sample the URM37 and output the measured
-# distance in cm, and temperature in degrees C
-
-while (1):
- print "Detected distance (cm):", sensor.getDistance()
- print "Temperature (C):", sensor.getTemperature()
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/urm37.py b/peripheral/libupm/examples/python/urm37.py
deleted file mode 100644
index fa977aa..0000000
--- a/peripheral/libupm/examples/python/urm37.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_urm37 as sensorObj
-
-# Instantiate a URM37 sensor on analog pin A0, reset pin on D2,
-# trigger pin on D3 with an analog reference voltage of 5.0
-sensor = sensorObj.URM37(0, 2, 3, 5.0)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Every half a second, sample the URM37 and output the measured
-# distance in cm.
-
-while (1):
- print "Detected distance (cm):", sensor.getDistance()
- time.sleep(.5)
diff --git a/peripheral/libupm/examples/python/using_carrays.py b/peripheral/libupm/examples/python/using_carrays.py
deleted file mode 100644
index 730cb36..0000000
--- a/peripheral/libupm/examples/python/using_carrays.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-
-# Author: Brendan Le Foll <brendan.le.foll@intel.com>
-# Copyright (c) 2014 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
-
-import pyupm_mic
-
-mymic = pyupm_mic.Microphone(1)
-# careful this is an unitialised array with no bounds checking!
-x = pyupm_mic.uint16Array(3)
-mymic.getSampledWindow(100, 3, x)
-
diff --git a/peripheral/libupm/examples/python/waterlevel.py b/peripheral/libupm/examples/python/waterlevel.py
deleted file mode 100644
index 18309e4..0000000
--- a/peripheral/libupm/examples/python/waterlevel.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_waterlevel as upmWaterlevel
-
-# The was tested with the Water Level Sensor
-# Instantiate a Water Level Sensor on digital pin D2
-myWaterLevel = upmWaterlevel.WaterLevel(2)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myWaterLevel
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myWaterLevel.isSubmerged()):
- print "Sensor is submerged in liquid"
- else:
- print "Liquid is below water level sensor"
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/wheelencoder.py b/peripheral/libupm/examples/python/wheelencoder.py
deleted file mode 100644
index b61cc87..0000000
--- a/peripheral/libupm/examples/python/wheelencoder.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_wheelencoder as sensorObj
-
-# Instantiate a DFRobot Wheel Encoder on digital pin D2
-sensor = sensorObj.WheelEncoder(2)
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# set the counter to 0 and start counting
-sensor.clearCounter();
-sensor.startCounter();
-
-while (1):
- print "Millis:", sensor.getMillis(), "Count:", sensor.counter()
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/wt5001.py b/peripheral/libupm/examples/python/wt5001.py
deleted file mode 100644
index 315799c..0000000
--- a/peripheral/libupm/examples/python/wt5001.py
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, signal, sys
-import pyupm_wt5001 as upmWt5001
-
-# Instantiate a WT5001 serial MP3 player on uart 0.
-# This example was tested on the Grove Serial MP3 module.
-myMP3Player = upmWt5001.WT5001(0)
-
-
-def printUsage(progname):
- print ("Usage: python " + progname + " <command>\n"
- "Commands:\n"
- "0 - stop playing\n"
- "1 - start playing track 1\n"
- "2 - pause/un-pause playback\n"
- "3 - next track\n"
- "4 - previous track")
-
-
-cmd = -1;
-if (len(sys.argv) > 1):
- cmd = int(sys.argv[1])
-
-if (not myMP3Player.setupTty(upmWt5001.cvar.int_B9600)):
- print "Failed to setup tty port parameters"
- sys.exit(0)
-
-if cmd == 0:
- myMP3Player.stop()
-elif cmd == 1:
- myMP3Player.play(upmWt5001.WT5001.SD, 1)
-elif cmd == 2:
- myMP3Player.pause()
-elif cmd == 3:
- myMP3Player.next()
-elif cmd == 4:
- myMP3Player.previous()
-else:
- # nothing, just output usage, and info below
- printUsage(sys.argv[0])
-
-
-# print out some information
-vol = upmWt5001.uint8Array(0)
-myMP3Player.getVolume(vol)
-print "The current volume is: " + str(vol.__getitem__(0))
-
-ps = upmWt5001.uint8Array(0)
-myMP3Player.getPlayState(ps)
-print "The current play state is: " + str(ps.__getitem__(0))
-
-numf = upmWt5001.uint16Array(0)
-myMP3Player.getNumFiles(upmWt5001.WT5001.SD, numf)
-print "The number of files on the SD card is: " + str(numf.__getitem__(0))
-
-curf = upmWt5001.uint16Array(0)
-myMP3Player.getCurrentFile(curf)
-print "The current file is: " + str(curf.__getitem__(0))
-
-
-# set the date
-myMP3Player.setDate(2015, 3, 14)
-
-# set the time
-myMP3Player.setTime(9, 26, 53)
-
-
-year = upmWt5001.uint16Array(0)
-month = upmWt5001.uint8Array(0)
-day = upmWt5001.uint8Array(0)
-
-myMP3Player.getDate(year, month, day)
-mp3date = str(month.__getitem__(0)) + "/"
-mp3date += (str(day.__getitem__(0)) + "/")
-mp3date += str(year.__getitem__(0))
-print "The device date is: " + mp3date
-
-hour = upmWt5001.uint8Array(0)
-minute = upmWt5001.uint8Array(0)
-second = upmWt5001.uint8Array(0)
-myMP3Player.getTime(hour, minute, second)
-mp3time = str(hour.__getitem__(0)) + ":"
-mp3time += (str(minute.__getitem__(0)) + ":")
-mp3time += str(second.__getitem__(0))
-print "The device time is: " + mp3time
diff --git a/peripheral/libupm/examples/python/xbee.py b/peripheral/libupm/examples/python/xbee.py
deleted file mode 100644
index 3ca3720..0000000
--- a/peripheral/libupm/examples/python/xbee.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/python
-# Author: Jon Trulson <jtrulson@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_xbee as sensorObj
-
-# Instantiate a XBee Module on UART 0
-sensor = sensorObj.XBee(0)
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-# Set the baud rate, 9600 baud is the default.
-if (sensor.setBaudRate(9600)):
- print "Failed to set baud rate"
- sys.exit(0)
-
-
-usageStr = ("Usage:\n"
-"If an argument is supplied on the command line, that argument is\n"
-"sent to the module and the response is printed out.\n\n"
-"If no argument is used, then the firmware revision, serial number\n"
-"and the current IP address (if set) are queried.\n\n")
-print usageStr
-
-# simple helper function to send a command and wait for a response
-def sendCommand(sensor, cmd):
- # commands need to be terminated with a carriage return
- cmd += "\r"
- sensor.writeDataStr(cmd)
-
- resp = ""
- while sensor.dataAvailable(2000):
- resp += sensor.readDataStr(1024)
-
- if not resp:
- print "Timed out waiting for response"
- else:
- resp = sensor.stringCR2LF(resp)
- print "Returned (", len(resp), "bytes):"
- print resp
-
-
-if (len(sys.argv) > 1):
- # enable command mode
- sensor.commandMode()
- print "Sending command line argument (" + sys.argv[1] + ")..."
- sendCommand(sensor, sys.argv[1])
-else:
- # enable command mode
- sensor.commandMode()
- # query the verbose firmware revision
- print "Querying verbose firmware revision (ATVL)..."
- sendCommand(sensor, "ATVL")
- # query the number
- print "Querying Serial Number High (ATSH)..."
- sendCommand(sensor, "ATSH")
- print "Querying Serial Number Low (ATSL)..."
- sendCommand(sensor, "ATSL")
-
- print "Querying address, if set (ATMY)..."
- sendCommand(sensor, "ATMY");
-
- # For the XBee WiFi S6B
- # A comprehensive list of commands and command modes is
- # available from the datasheet at:
- # ftp1.digi.com/support/documentation/90002180_L.pdf
-
- # For the XBee S1
- # A comprehensive list of commands and command modes is
- # available from the datasheet at:
- # http://www.sparkfun.com/datasheets/Wireless/Zigbee/XBee-Datasheet.pdf
-
- # For the XBee WiFi module:
- # An example using AT commands to connect to an AP, with a
- # private Key using WPA2:
-
- # Connect to AP with SSID 'mySSID':
- # ATIDmySSID
-
- # Provide the private key 'secret':
- # ATPKsecret
-
- # Use WPA2 encryption
- # ATEE2
-
diff --git a/peripheral/libupm/examples/python/yg1006.py b/peripheral/libupm/examples/python/yg1006.py
deleted file mode 100644
index 6f21c1d..0000000
--- a/peripheral/libupm/examples/python/yg1006.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_yg1006 as upmYG1006
-
-# Instantiate a flame sensor on digital pin D2
-myFlameSensor = upmYG1006.YG1006(2)
-
-
-## Exit handlers ##
-# This function stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit, including functions from myFlameSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-while(1):
- if (myFlameSensor.flameDetected()):
- print "Flame detected."
- else:
- print "No flame detected."
-
- time.sleep(1)
diff --git a/peripheral/libupm/examples/python/zfm20-register.py b/peripheral/libupm/examples/python/zfm20-register.py
deleted file mode 100644
index 589a4df..0000000
--- a/peripheral/libupm/examples/python/zfm20-register.py
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_zfm20 as upmZfm20
-
-# Instantiate a ZFM20 Fingerprint reader on UART 0
-myFingerprintSensor = upmZfm20.ZFM20(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myFingerprintSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# make sure port is initialized properly. 57600 baud is the default.
-if (not myFingerprintSensor.setupTty(upmZfm20.cvar.int_B57600)):
- print "Failed to setup tty port parameters"
- sys.exit(1)
-
-
-# This example demonstrates registering a fingerprint on the zfm20
-# module. The procedure is as follows:
-#
-# 1. get an image, store it in characteristics buffer 1
-# 2. get another image, store it in characteristics buffer 2
-# 3. store the image, assuming the two fingerprints match
-
-# first, we need to register our address and password
-
-myFingerprintSensor.setPassword(upmZfm20.ZFM20_DEFAULT_PASSWORD)
-myFingerprintSensor.setAddress(upmZfm20.ZFM20_DEFAULT_ADDRESS)
-
-# now verify the password. If this fails, any other commands
-# will be ignored, so we just bail.
-if (myFingerprintSensor.verifyPassword()):
- print "Password verified."
-else:
- print "Password verification failed."
- sys.exit(1)
-
-
-print " "
-
-# get the first image
-print "Place a finger on the sensor."
-while (myFingerprintSensor.generateImage() != upmZfm20.ZFM20.ERR_OK):
- pass
-
-# in theory, we have an image
-print "Image captured, converting..."
-
-rv = myFingerprintSensor.image2Tz(1)
-
-if (rv != upmZfm20.ZFM20.ERR_OK):
- print "Image conversion failed with error code %d" % rv
- sys.exit(1)
-
-print "Image conversion succeeded, remove finger."
-time.sleep(1)
-
-while (myFingerprintSensor.generateImage() != upmZfm20.ZFM20.ERR_NO_FINGER):
- pass
-
-print " "
-print "Now place the same finger on the sensor."
-
-while (myFingerprintSensor.generateImage() == upmZfm20.ZFM20.ERR_NO_FINGER):
- pass
-
-print "Image captured, converting..."
-
-# save this one in slot 2
-rv = myFingerprintSensor.image2Tz(2)
-if (rv != upmZfm20.ZFM20.ERR_OK):
- print "Image conversion failed with error code %d" % rv
- sys.exit(1)
-
-print "Image conversion succeeded, remove finger."
-print " "
-
-print "Storing fingerprint at id 1"
-
-# create the model
-rv = myFingerprintSensor.createModel()
-if (rv != upmZfm20.ZFM20.ERR_OK):
- if (rv == upmZfm20.ZFM20.ERR_FP_ENROLLMISMATCH):
- print "Fingerprints did not match."
- else:
- print "createModel failed with error code %d" % rv
- sys.exit(1)
-
-# now store it, we hard code the id (second arg) to 1 here
-rv = myFingerprintSensor.storeModel(1, 1)
-if (rv != upmZfm20.ZFM20.ERR_OK):
- print "storeModel failed with error code %d" % rv
- sys.exit(1)
-
-print " "
-print "Fingerprint stored at id 1."
-
diff --git a/peripheral/libupm/examples/python/zfm20.py b/peripheral/libupm/examples/python/zfm20.py
deleted file mode 100644
index e813e47..0000000
--- a/peripheral/libupm/examples/python/zfm20.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/python
-# Author: Zion Orent <zorent@ics.com>
-# Copyright (c) 2015 Intel Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import time, sys, signal, atexit
-import pyupm_zfm20 as upmZfm20
-
-# Instantiate a ZFM20 Fingerprint reader on UART 0
-myFingerprintSensor = upmZfm20.ZFM20(0)
-
-
-## Exit handlers ##
-# This stops python from printing a stacktrace when you hit control-C
-def SIGINTHandler(signum, frame):
- raise SystemExit
-
-# This function lets you run code on exit,
-# including functions from myFingerprintSensor
-def exitHandler():
- print "Exiting"
- sys.exit(0)
-
-# Register exit handlers
-atexit.register(exitHandler)
-signal.signal(signal.SIGINT, SIGINTHandler)
-
-
-# make sure port is initialized properly. 57600 baud is the default.
-if (not myFingerprintSensor.setupTty(upmZfm20.cvar.int_B57600)):
- print "Failed to setup tty port parameters"
- sys.exit(1)
-
-# how many valid stored templates (fingerprints) do we have?
-print "Total stored templates: %d" % myFingerprintSensor.getNumTemplates()
-print " "
-
-# now spin waiting for a fingerprint to successfully image
-print "Waiting for finger print..."
-
-while (myFingerprintSensor.generateImage() == upmZfm20.ZFM20.ERR_NO_FINGER):
- pass
-
-# in theory, we have an image
-print "Image captured, converting..."
-
-rv = myFingerprintSensor.image2Tz(1)
-if (rv != upmZfm20.ZFM20.ERR_OK):
- print "Image conversion failed with error code %d" % rv
- sys.exit(1)
-
-print "Image conversion succeeded."
-print "Searching database..."
-
-myid = upmZfm20.uint16Array(0)
-myid.__setitem__(0, 0)
-myscore = upmZfm20.uint16Array(0)
-myscore.__setitem__(0, 0)
-
-# we search for a print matching slot 1, where we stored our last
-# converted fingerprint
-rv = myFingerprintSensor.search(1, myid, myscore)
-if (rv != upmZfm20.ZFM20.ERR_OK):
- if (rv == upmZfm20.ZFM20.ERR_FP_NOTFOUND):
- print "Finger Print not found"
- sys.exit(0)
- else:
- print "Search failed with error code %d" % rv
- sys.exit(1)
-
-print "Fingerprint found!"
-print "ID: %d, Score: %d" % (myid.__getitem__(0), myscore.__getitem__(0))