Esempio n. 1
0
#!/usr/bin/env python

import time
import Netmaxiot
led = 5
Netmaxiot.pinMode(led, "OUTPUT")
time.sleep(1)
i = 0
while True:
    try:
        # Reset
        if i > 255:
            i = 0

        # Current brightness
        print(i)

        # Give PWM output to LED
        Netmaxiot.analogWrite(led, i)

        # Increment brightness for next iteration
        i = i + 10
        time.sleep(.2)

    except KeyboardInterrupt:
        Netmaxiot.analogWrite(led, 0)
        break
    except IOError:
        print("Error")
#!/usr/bin/env python
import time
import Netmaxiot
Netmaxiot.pinMode(2, "OUTPUT")
Netmaxiot.pinMode(3, "OUTPUT")
Netmaxiot.pinMode(4, "OUTPUT")
Netmaxiot.pinMode(5, "OUTPUT")
Netmaxiot.pinMode(6, "OUTPUT")
time.sleep(1)
i = 0
try:
    Netmaxiot.digitalWrite(2, 0)
    Netmaxiot.digitalWrite(3, 0)
    Netmaxiot.digitalWrite(4, 0)

    Netmaxiot.analogWrite(3, 255)
    time.sleep(2)
    Netmaxiot.analogWrite(3, 128)
    time.sleep(2)
    while True:
        print(i)
        Netmaxiot.analogWrite(3, i)
        Netmaxiot.analogWrite(5, i)
        Netmaxiot.analogWrite(6, i)
        i = i + 5

        time.sleep(0.05)
        if i > 255:
            i = 0
except KeyboardInterrupt:
    Netmaxiot.analogWrite(3, 0)
from time import sleep
import Netmaxiot
Netmaxiot.pinMode(3, "OUTPUT")
Netmaxiot.pinMode(5, "OUTPUT")
Netmaxiot.pinMode(6, "OUTPUT")
i = 0
while True:
    print(i)
    Netmaxiot.analogWrite(3, i)
    Netmaxiot.analogWrite(5, i)
    Netmaxiot.analogWrite(6, i)
    i = i + 10
    sleep(0.2)
    if i > 255:
        i = 0
Esempio n. 4
0
led=3
led1=5
led2=6
Netmaxiot.pinMode(led,"OUTPUT")
Netmaxiot.pinMode(led1,"OUTPUT")
Netmaxiot.pinMode(led2,"OUTPUT")
sleep(1)
i=0
try:
	Netmaxiot.digitalWrite(led,0)
	Netmaxiot.digitalWrite(led1,0)
	Netmaxiot.digitalWrite(led2,0)
	while 1:
		print(i)
		print("analog pin 3,5,6,9")
		Netmaxiot.analogWrite(led,i)
		Netmaxiot.analogWrite(led1,i)
		Netmaxiot.analogWrite(led2,i)

		i=i+5
		sleep(0.05)
		if(i>255):
			i=0
except KeyboardInterrupt:
	Netmaxiot.digitalWrite(led,0)
	Netmaxiot.digitalWrite(led1,0)
	Netmaxiot.digitalWrite(led2,0)