That code I looked at yesterday was pretty weird. I've never used a RPi myself, but I just had a quick look at these docs so I think I can give you good code that will convert signed 8 bit numbers to a bit list you can send to GPIO pins with GPIO.output
@heather Ok. You need to slow down and totally understand how Hz works. It's really simple. Frequency is the reciprocal of time. So something that happens 25 times per second has a frequency of 25 Hz. Each cycle takes 1/25 th of a second.
@PM2Ring ah, yep, that's what i did - if one cycle takes 1.1 * 10^-5 seconds, i can just do 1/that = hz value, which gave me 90,909.1 hz, which then move the decimal point over for kilo, and 91 khz.
it's just how often something happens in [unit of time, generally seconds].
You may know that the power plugs have alternating voltage, with 110 V effective value in the US and 230 V in Europe. The frequency of the corresponding harmonic oscillation is usually around 50-60 Hz
this is something that experimentalists have to take into account, because that 50 Hz can couple over to virtually anything and end up as an artifact in frequency-dependent measurements
I also heard of one case where the 100 Hz power oscillation (corresponding to the 50 Hz voltage oscillation) led to a vibration in a pump in a neighbouring laboratory and ended up messing with an atomic force microscopy measurement
apparently measuring forces with atomic precision is fickle business...
With old AM radios, especially in the early ones that used valves (aka vacuum tubes) there was always a noticeable 50 Hz hum in the background. You can still hear it in stuff like guitar amplifiers that use valves.
@AndrasDeak lol yeah, i'm thinking i'm just gonna have to slow down the FPGA clock to maybe 2 MHz. That's still pretty fast, and the arduino can apparently handle that, so.
well...the way i've written my verilog code, which is probably all wrong since i've never programmed in verilog before ~10 days ago, is that everything happens on the rising edge of the FPGA's clock.
Hmm, but wouldn't that mean that if the input doesn't change for 10k cycles then it just recomputes the same things? (last honestly naive question, I promise)
if the computation is stateless then the only difference should be that with a higher clock frequency there's a lot more energy wasted and your room will get much warmer for the same result
then definitely doing 10k idle steps is different than 1 single step: there's a factor of 10k difference in the next contribution :)
although if you're integrating correctly then the 10k steps with 1/10k time step size would give you almost the same integral, basically using a finer temporal mesh to integrate a slowly varying piecewise-constant function
Oh. I almost forgot. Here's that bitlist code. From the docs, it looks like GPIO.output(chan_list, (GPIO.HIGH,GPIO.LOW)) wants its bit data as a tuple. So that's what my code produces. But maybe it can accept a list, and that would be slightly faster here.
def signed_to_bits(n):
return tuple(int(u) for u in f'{n & 0xff:08b}')
# test with all legal signed 8 bit values
for i in range(-128, 128):
print(i, signed_to_bits(i))
@heather So, there are two scenarios. In both cases your input changes in, say, 200 mus (microseconds). In the first case you leave the FGPA alone and take 10k cycles with dt=20 ns while the value of the input is unchanged. You'd compute the same integral contribution 10k times with the small dt time step. In the second case you slow down the FGPA and have (optimally) 1 cycle with dt=200 mus, and compute the integral contribution (from the same function value) with a single large time step.
the results should be the same, except from slight integration errors for when the value of the input changes
@heather That's standard for CMOS and related technology. Old-fashioned TTL logic uses voltage levels, but CMOS uses edge detection. That has several advantages, the main one being that exact supply voltage isn't critical.
@AndrasDeak FPGA = Field-Programmable Gate Array, although there are a few other expansion of the acronym. Basically a chip that you can program to do fun things with boolean logic.
@PM2Ring Does anyone do those anymore? I remember my dad doing some work for the city when I was a kid and being the only guy who knew how to fix/meddle with that stuff.
@toonarmycaptain No idea. I guess I would've heard about FPAAs years ago, but if so, I've forgotten about them. I don't keep up with hardware like I did when I was young. And I must admit that I was always more into digital hardware than analog anyway. Although I did get the chance to mess around for a few months with a cute analog computer in the mid 1970s.
can i get list of all models that have foreign key of that model.Eg. A->B , C->B , D-> B then how can I get a list ( [A,C,D] ) from the model B in django?
@ReblochonMasque same here. I was cursing Firefox for it, before I saw your post. Gravatars are loading fine, stackoverflow images aren't loading because of insecure SSL.
It's risky of me to make jokes about the difficulty of typing various characters, because in an international community like this you never know when someone will say "actually, on Finnish keyboards there's a dedicated "λ" key, right next to the "Æ""
> The encompassing keyboard design -- with six separate pads of kanji characters, a pad for emoticons and a giant Enter button -- puts every single standard-issue Japanese typograph at the users' fingertips. There are also floor pedals of unknown purpose.
I liked the dup link you gave @DSM. Since I've answered that question countless times, I had to throw my entry on the dup target stackoverflow.com/a/51752361/2336654
The directory '/Users/myName/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Hello, I am trying to install pandas
with pip install pandas, or sudo pip install pandas, or sudo pip install --user pandas ... nothing works, when I do import pandas there is no module named pandas
it was a most ungraceful and unpleasant encounter. I do not recommend.
unrelated ... that being said, I could have thought about it, but dependency injection container creation sucks in type less languages. That is, when you create more than a glorified array.
With type hint, it's possible to use reflection so that you can actually automate that process, which greatly simplifies bootstrapping of an application. Typeless languages and non reflection based dic's need to be configured manually, through language, xml, or whatevs, which tends to become quite ugly very fast
I'm not quite sure how to search/ask for this. I notice that passing a function "reference" does not work the same as passing a class method. config.add_view(function) vs config.add_view(class.method). Indeed, the latter fails with argument number errors, because the method expects the first arg to be the class instance. Why can't the object be passed with the method reference, if that makes any sense?
@AndrasDeak hmmm.. thanks for making me double check. The code throwing the error is not the one I though. I was passing instance.method already, the error happens elsewhere where I did not instantiate the class. :)
a decorator over the method is causing the problem. I add cornice decorators over an api methods so that a swagger definition be generated. The decorating caller throws the argument mismatch error.
I am changing from module scope functions to an instantiated class so that I can pass the database object used in it as an argument to the constructor, so that I can write tests more easily. The endeavour is taking more time than I would have hoped :)