How to Make a Transaction in IOTA

from iota import *

api = Iota('https://host', 'SampleSeed')

pt = ProposedTransaction(address = Address('SampleOutput'), value = 100)

in_addy = Address('SampleInput') # 0 or more

ch_addy = Address('SampleChange') # 0 or 1

api.send_transfer(transfers = [ pt ], inputs = [ in_addy ], change_address = [ ch_addy ])

How to Connect to a Network with Grove UART Wi-Fi in Raspberry Pi

1) Connect the module to the RPISER port.

2) Install the hat library.

3) Enable the UART.

4) Disable the serial console.

5) If you want to use the PL011 UART instead of the mini UART (recommended), add the pi3-disable-bt or pi3-miniuart-bt overlays to the device tree, and disable the hciuart service.

6) Restart the Pi.

7) Run the following code:

import serial
import time

ser = serial.Serial('/dev/ttyAMA0', 115200) # or /dev/ttyS0 if using the mini UART

ser.write('ATE0\r\n') # disable echo

time.sleep(5)

while ser.in_waiting > 0:

  if ser.readline() == 'OK\r\n':
    ser.write('AT+CWJAP_CUR="SampleNetwork","SamplePassword"\r\n') # connect to AP

    time.sleep(5)

    while ser.in_waiting > 0:

      if ser.readline() == 'OK\r\n':
        print "Connected!"

        break

    break

How to Get Voltage with a Grove Voltage Divider in Raspberry Pi

1) Connect the module to the A0 port.

2) Install the hat library.

3) Run the following code:

from grovepi import *

import time

PIN = 2

while True:
  print 3 * analogRead(PIN) * 5 / 1023.0 # 3 = dial switch voltage, 5 = input voltage

  time.sleep(1)

How to Get Rotary Angle from a Grove Rotary Angle Sensor in Raspberry Pi

1) Connect the module to the A0 port.

2) Install the hat library.

3) Run the following code:

from grovepi import *

import time

PIN = 0

while True:
  v = analogRead(PIN)

  print ((v * 5 / 1023.0) * 300) / 5; # 5 = ADC reference voltage, 5 = hat voltage

  time.sleep(1)