Ejemplo n.º 1
0
# P9_19 --->  SCL (MCP4725)
# P9_20 --->  SDA (MCP4725)

from mcp4725 import setup_bus, dac
import math
from time import sleep
from termcolor import colored

#--------------------------------

print colored('---------------------------', 'green')
print colored('Press CTRL+C to stop', 'red')
print colored('setup: mcp4725  ---->  SAW ', 'red')
print colored('---------------------------', 'green')
sleep(0.5)

bus = setup_bus(3)

#--------------------------------
while (True):
    v = 512  # v: 0 --> 4095
    for n in range(0, v):
        dac(bus, n)
Ejemplo n.º 2
0
# P9_19 --->  SCL (MCP4725)
# P9_20 --->  SDA (MCP4725)

from  mcp4725 import setup_bus, dac
import math
from time import sleep
from termcolor import colored

#--------------------------------

def sin(x,y):
    a=math.sin(math.pi*(x/180.0))
    return int(y*(a+1)/2)

#--------------------------------

print colored('---------------------------','green')
print colored('Press CTRL+C to stop','red')
print colored('setup: mcp4725 ---->  SINE ','red')
print colored('---------------------------','green')
sleep(0.5)

bus = setup_bus(3)

#--------------------------------
while(True):
	v=1024 						# v: 0 --> 4095
	for n in range(0,360):
		dac(bus,sin(n,v))	
Ejemplo n.º 3
0
# P9_20 --->  SDA (MCP4725)

from mcp4725 import setup_bus, dac
import math
from time import sleep
from termcolor import colored

#--------------------------------


def sin(x, y):
    a = math.sin(math.pi * (x / 180.0))
    return int(y * (a + 1) / 2)


#--------------------------------

print colored('---------------------------', 'green')
print colored('Press CTRL+C to stop', 'red')
print colored('setup: mcp4725 ---->  SINE ', 'red')
print colored('---------------------------', 'green')
sleep(0.5)

bus = setup_bus(3)

#--------------------------------
while (True):
    v = 1024  # v: 0 --> 4095
    for n in range(0, 360):
        dac(bus, sin(n, v))
Ejemplo n.º 4
0
# P9_19 --->  SCL (MCP4725)
# P9_20 --->  SDA (MCP4725)

from mcp4725 import setup_bus, dac
import math
from time import sleep
from termcolor import colored
from time import sleep

#--------------------------------

print colored('---------------------------', 'green')
print colored('Press CTRL+C to stop', 'red')
print colored('setup: mcp4725 -->  SQUARE ', 'red')
print colored('---------------------------', 'green')
sleep(0.5)

bus = setup_bus(3)
v = 1024  # v: 0 --> 4095

#--------------------------------
while (True):
    dac(bus, v)
    sleep(0.100)
    dac(bus, v / 2)
    sleep(0.200)
    dac(bus, 0)
    sleep(0.300)
Ejemplo n.º 5
0
# P9_19 --->  SCL (MCP4725)
# P9_20 --->  SDA (MCP4725)

from  mcp4725 import setup_bus, dac
import math
from time import sleep
from termcolor import colored

#--------------------------------

print colored('---------------------------','green')
print colored('Press CTRL+C to stop','red')
print colored('setup: mcp4725  ---->  SAW ','red')
print colored('---------------------------','green')
sleep(0.5)

bus = setup_bus(3)

#--------------------------------
while(True):
	v=512					 # v: 0 --> 4095
	for n in range(0,v):
		dac(bus,n)	
Ejemplo n.º 6
0
# P9_19 --->  SCL (MCP4725)
# P9_20 --->  SDA (MCP4725)

from  mcp4725 import setup_bus, dac
import math
from time import sleep
from termcolor import colored
from time import sleep

#--------------------------------

print colored('---------------------------','green')
print colored('Press CTRL+C to stop','red')
print colored('setup: mcp4725 -->  SQUARE ','red')
print colored('---------------------------','green')
sleep(0.5)

bus = setup_bus(3)
v=1024					 # v: 0 --> 4095

#--------------------------------
while(True):
	dac(bus,v)
	sleep(0.100)
	dac(bus,v/2)
	sleep(0.200)
	dac(bus,0)
	sleep(0.300)