Monday, August 2, 2021
python to control the stepmotor nema11
#finally it works! the wait time has to be finetuned to prevent the wobbling
import RPi.GPIO as GPIO
from RpiMotorLib import RpiMotorLib
import time
################################
# RPi and Motor Pre-allocations
################################
#
#define GPIO pins
GpioPins=[21,22,23,24]
# Declare a instance of class pass GPIO pins numbers and the motor type
#mymotortest = RpiMotorLib.A4988Nema(direction, step, (21,21,21), "DRV8825")
mymotortest = RpiMotorLib.BYJMotor("Mymotorone", "Nema")
#mymotortest = RpiMotorLib.A4988Nema(direction, step, (21,21,21), "A4948")
for i in range(5):
time.sleep(1)
mymotortest.motor_run(GpioPins, 0.0002, 1600, True, False, "full", .05)#pins, wait, steps, ccwise, verbose, steptype,inidelay
time.sleep(1)
mymotortest.motor_run(GpioPins, 0.0003, 1600, False, False, "full", .05)#pins, wait, steps, ccwise, verbose, steptype,inidelay
GPIO.cleanup() # clear GPIO allocations after run
Monday, July 19, 2021
open image sequence with filter of more than one criteria
It took some effort, but I figure out the code should be:
File name contains: (.*_F_.*tif)
This means there is a "_F" in file name and the type of images is tif
Friday, July 2, 2021
3d mouse brain and skull model
Very nice 3d model:
https://www.thingiverse.com/thing:3079327
This is how to make it smaller in file size so it can be imported to Tinkercad
https://3dtomorrow.com/2019/07/17/how-to-reduce-file-size-in-meshmixer/
Wednesday, June 30, 2021
To convert 2-column vectors to 5 column vectors for comparison of grouped data
target=half_decay;
grp=1:5;
grouplength=ones(1,5);
for i=1:5
grouplength(i)=length(find(target(:,2)==i));
end
largest_groupnumber=max(grouplength);
finalmatrix=NaN(largest_groupnumber,5);
for ii=1:5
for iii=1:grouplength(ii)
aa=target(find(target(:,2)==ii));
finalmatrix(iii,ii)=aa(iii);
end
end
Wednesday, February 17, 2021
Language tips: dire
There is a burning need to develope effective therapeutics toward... : Burning to "dire"
Subscribe to:
Posts (Atom)