Search found 35 matches

by mschulz
Thu Jun 11, 2015 12:26 pm
Forum: General Discussion and Questions
Topic: Matrix (with numpy)
Replies: 4
Views: 5714

Re: Matrix (with numpy)

Thank you, I now use a array.array.
by mschulz
Thu Jun 11, 2015 12:24 pm
Forum: General Discussion and Questions
Topic: adc.read_timed(buf, freq)
Replies: 9
Views: 7558

Re: adc.read_timed(buf, freq)

When I trie the calculate the average with

Code: Select all

import pyb
import array
self.__buf0=array.array('H',[0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0])
self.__Umess  = array.sum(self.__buf0)/30
I get the error "module" object has no attribute "sum".?
by mschulz
Thu Jun 11, 2015 8:54 am
Forum: General Discussion and Questions
Topic: Matrix (with numpy)
Replies: 4
Views: 5714

Re: Matrix (with numpy)

Ok, I know that MicroPython does not support all librarys.
But I hope there is an way to use nympy or somthing else to create a matrix?

You have a good Idea to solve the problem?
by mschulz
Thu Jun 11, 2015 8:25 am
Forum: General Discussion and Questions
Topic: Matrix (with numpy)
Replies: 4
Views: 5714

Matrix (with numpy)

Hello I want to write the values of 8 ADC continuously into a Puffer. So I want to use a Matrix for the values http://stackoverflow.com/questions/6667201/how-to-define-two-dimensional-array-in-python import numpy buf2= numpy.zeros((5, 5)) print(buf2) buf2[1][1]=1,1111 print(buf2) But I get the error...
by mschulz
Wed Jun 10, 2015 9:29 am
Forum: General Discussion and Questions
Topic: adc.read_timed(buf, freq)
Replies: 9
Views: 7558

Re: adc.read_timed(buf, freq)

Thank you very much!

Whitch is the easiest was to say the adc to read continuously into the buffer (and when ist is full start at the beginn)

When I read timed to buffer is the controller blocked while this time, or can he calc other thinks?
How I can create a matrix for measurements (fror 8 ADC)?
by mschulz
Tue Jun 09, 2015 12:49 pm
Forum: General Discussion and Questions
Topic: adc.read_timed(buf, freq)
Replies: 9
Views: 7558

Re: adc.read_timed(buf, freq)

ah, ok, Thank you Put the read_timned() function the last value at the end and if the buffer is full, it starts at the begin? When ends the adc with reading? With my code I think it read only one time until the buffer is full? How I can read a single value from the array? Which is the best way to ca...
by mschulz
Tue Jun 09, 2015 11:26 am
Forum: General Discussion and Questions
Topic: adc.read_timed(buf, freq)
Replies: 9
Views: 7558

Re: adc.read_timed(buf, freq)

Thank you, I forget it. adc = pyb.ADC(pyb.Pin.board.X19) # create an ADC on pin X19 buf = array.array('H') # create a buffer of 100 bytes adc.read_timed(buf, 10) # read analog values into buf at 10Hz while not switch(): # this will take 10 seconds to finish for val in buf: # loop over all values pri...
by mschulz
Tue Jun 09, 2015 8:18 am
Forum: General Discussion and Questions
Topic: adc.read_timed(buf, freq)
Replies: 9
Views: 7558

adc.read_timed(buf, freq)

Hello, I need your help again. I want to read the ADC with a constant frequenz and I found the adc.read_timed(buf, freq) function and this example Example: http://docs.micropython.org/en/latest/library/pyb.ADC.html#adc.read_timed adc = pyb.ADC(pyb.Pin.board.X19) # create an ADC on pin X19 buf = byte...
by mschulz
Mon Apr 27, 2015 7:56 am
Forum: General Discussion and Questions
Topic: object-oriented programming
Replies: 11
Views: 11020

Re: object-oriented programming

With an other pins it works, But the switch callback # USR Schalter print ('INIT des Schalters') switch = pyb.Switch() def switchcallback(): print('INFO-Switch: Switch Callback aufgerufen!') switch.callback(lambda :switchcallback()) only starts one time. Which is the best solution to stop the schedu...
by mschulz
Fri Apr 24, 2015 11:46 am
Forum: General Discussion and Questions
Topic: object-oriented programming
Replies: 11
Views: 11020

Re: object-oriented programming

Hello Thank you. The "global was only a experiment. But I have an other question. Now I use the Scheduler (and it works), But how I can use a switch or Hardware interrupt? bevore I start the scheduler with sched.run() it works. def callback1(line): print("DEBUG: Hardware Y3 Interupt!") ext1.disable(...