from rascam import Ras_Cam,run_command,Joystick_Motion_type import time import datetime if __name__ == "__main__": try: # clear all the jpg file # print("clean all the jpg file in 5 seconds later") print("clean all the jpg file in 5 seconds later") time.sleep(5) run_command("sudo rm /home/pi/Pictures/time_lapse_video/*.jpg") # print("clean finish!") # w : Photo width # h : Photo height # o : Output photo file name # rot : Rotation angle # -t : Total shooting length # tl : Interval between shots print("start to take picture") run_command("sudo raspistill -w 1920 -h 1440 -o /home/pi/Pictures/time_lapse_video/image_%08d.jpg -t 750000 -tl 3000") # 2000 = 2000ms =2s # r : frame rate # i : input file name # vcodec : Video codecs # The last string parameter is the output file name print("Making videos...") print("ffmpeg -r 25 -i /home/pi/Pictures/time_lapse_video/image_%08d.jpg -vcodec libx264 /home/pi/Pictures/time_lapse_video/" + datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S') + ".mp4") run_command("ffmpeg -r 25 -i /home/pi/Pictures/time_lapse_video/image_%08d.jpg -vcodec libx264 /home/pi/Pictures/time_lapse_video/" + datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S') + ".mp4") # r: FPS print("Finish!") # run_command("sudo rm /home/pi/Pictures/time_lapse_video/*.jpg")
from rascam import Ras_Cam, Joystick_Motion_type, run_command import time if __name__ == "__main__": try: Ras_Cam.camera_start() while True: button_type = Joystick_Motion_type() if button_type == 'left': Ras_Cam.photo_effect('sub') # Left shift switch. elif button_type == 'right': Ras_Cam.photo_effect('add') # Right shift switch. elif button_type == 'shuttle': Ras_Cam.shuttle_button(True) finally: run_command( "sudo kill $(ps aux | grep 'photo_effect.py' | awk '{ print $2 }')" )
from rascam import Ras_Cam,power_val,getIP,run_command,ADC import time if __name__ == "__main__": try: adc_channel_1 = ADC("A0") # only two adc channel ("A0" OR "A1") adc_channel_2 = ADC("A1") counter_num = 0 content_1_x = 0 content_1_color = [255,0,255] # content 1 text color ([R,G,B]) content_2_color = [0,255,255] # content 2 text color content_3_color = [255,255,0] # content 3 text color font_size = 0.5 # content font size (The best range is 0.5 ~ 0.8) Ras_Cam.camera_start() # start camera and screen content_1 = "IP: " + str(getIP()) # get the ip of Pi while True: #show content Ras_Cam.show_content(1, content_1, (int(content_1_x),15), content_1_color, font_size) # the first aram must have, and The different content should be sorted in order(start from 1) Ras_Cam.show_content(2, "camera power: " + str(power_val()) + "V", (0,35), content_2_color, font_size) Ras_Cam.show_content(3, "ADC_1: " + str(adc_channel_1.read()), (0,55), content_3_color, font_size) Ras_Cam.show_content(4, "ADC_2: " + str(adc_channel_2.read()), (0,75), content_3_color, font_size) finally: run_command("sudo kill $(ps aux | grep 'add_content_on_screen.py' | awk '{ print $2 }')")
from rascam import calibrate_imu_acc,run_command import time if __name__ == "__main__": try: calibrate_imu_acc() while True: pass finally: run_command("sudo kill $(ps aux | grep 'calibrate_camera_imu.py' | awk '{ print $2 }')")
import time # Eight seconds to the photo.the rgb will move if __name__ == "__main__": try: Ras_Cam.camera_start() rr = RGB_Matrix(0X74) total_time = 8 #set the total time of countdown (uint: second) while True: button_type = Joystick_Motion_type() if button_type == 'shuttle': for i in range(9): if i == 8: rr.draw_line((1, 8), fill=(0, 255, 0)) rr.display() break rr.draw_point((i), fill=(255, 0, 0)) rr.display() time.sleep(float(total_time) / 8) Ras_Cam.shuttle_button(True) time.sleep(1) rr.draw_line((1, 8), fill=(0, 0, 0)) rr.display() finally: run_command( "sudo kill $(ps aux | grep 'countdown photo.py' | awk '{ print $2 }')" )
from rascam import Ras_Cam, Joystick_Motion_type, RGB_Matrix, run_command, PWM import time if __name__ == "__main__": try: P1_Channel = PWM("P0") # only "P0" and "P1" two pwm channels Ras_Cam.camera_start() # Ras_Cam.human_detect_switch(True) # rr = RGB_Matrix(0X74) i = 0 sub_val = 1 while True: i += sub_val if i >= 100 or i <= 0: sub_val *= -1 P1_Channel.pulse_width_percent(i) time.sleep(0.1) finally: run_command( "sudo kill $(ps aux | grep 'take_picture.py' | awk '{ print $2 }')" )
from rascam import Ras_Cam, Joystick_Motion_type, RGB_Matrix, run_command import time if __name__ == "__main__": try: Ras_Cam.camera_start() rr = RGB_Matrix(0X74) while True: button_type = Joystick_Motion_type() if button_type == 'shuttle': rr.draw_line([1, 8], fill=(255, 255, 255)) rr.display() # open the rgb time.sleep(0.5) Ras_Cam.shuttle_button(True) time.sleep(0.5) rr.draw_line([1, 8], fill=(0, 0, 0)) # close the rgb rr.display() finally: run_command( "sudo kill $(ps aux | grep 'flash_light_camera.py' | awk '{ print $2 }')" )
setting_val_index = camera_setting_dict[camera_type].index( camera_val) if setting_val_index < setting_choice_num - 1: setting_val_index += 1 Ras_Cam.change_setting_type_val( camera_type, camera_setting_dict[camera_type] [setting_val_index]) #change the current setting elif button_type == 'down': camera_type, camera_val = Ras_Cam.change_show_setting( shirt_way='None') print(camera_type, camera_val) # setting_choice_num = len(camera_setting_dict[camera_type]) setting_val_index = camera_setting_dict[camera_type].index( camera_val) if setting_val_index > 0: setting_val_index -= 1 Ras_Cam.change_setting_type_val( camera_type, camera_setting_dict[camera_type] [setting_val_index]) #change the current setting if button_type == 'shuttle': Ras_Cam.shuttle_button(True) finally: # pass run_command( "sudo kill $(ps aux | grep 'show_and_change_camera_setting.py' | awk '{ print $2 }')" )