tayaapplications.blogg.se

Ww2 online tank
Ww2 online tank










  1. #Ww2 online tank serial
  2. #Ww2 online tank driver

set_pwm_freq ( 60 ) def deg_to_pulse ( self, degree ): pulse = ( degree - 0 ) * ( self. start ( 0 ) def configServos ( self ): self. OUT ) #self.motor_pwm.append(GPIO.PWM(pin, 490)) self. OUT ) def configMotors ( self, mL1, mL2, mR1, mR2, invertLR = False ): self.

#Ww2 online tank serial

ser = Serial ( BT_Port, baudrate = 9600, timeout = 0 ) self. This is a fun and entertaining take on laser tag, and I would again like to thank DFRobot for supplying the MiniQ Robot Chassis Kits.įrom _future_ import division import RPi.GPIO as GPIO from time import sleep from serial import Serial import json import Adafruit_PCA9685 class Car ( object ): def _init_ ( self, BT_Port, laser_pin ): GPIO. This will bind the Bluetooth port to a serial port, allowing the pyserial library to read the data from the HC-05.Īnd that’s it! I drove my tank and my dad drove the other one, circling and firing at each other until one of us had our crew knocked out. Now just type exitĪnd then run the program by first typing sudo rfcomm bind /dev/rfcomm1 MAC_ADDR It will ask for the PIN to pair, which is 1234. Is the MAC address that showed up for the HC-05 module. To do that, I turned on one controller and then typed bluetoothctlĪnd after the controller showed up as HC-05 I typed scan off View the attached code to see more.Īfter meticulously building each tank and controller, it was finally time to use them in a game, but first I had to pair each tank with its respective controller. It uses the Arduino Timer library to control how often analog data gets sampled, along with controlling reload speeds and laser firing time.

#Ww2 online tank driver

5V for the Pi, laser, and servos 3.3V for the ADC and servo driver 6~12V for the motors. First I divided up each component into voltage requirements. Now there was the question of “How do I power this?” I had to provide power for 2 servos, a Raspberry Pi Zero W, an ADC, a laser diode, and 2 motors. Tank Electronics Part 2: Power and Servos Just connect IN to pin 18 and VCC to +5v. Optionally, you can add an lm386n if you want sound effects. The ADS1115 also has a Python library that was made by Adafruit, which allows for the gain to be set and read each of the four channels. The ADS1115 is an amazing, tiny, 4 channel analog to digital converter that communicates over I2C, so it uses only 2 wires, which frees up some precious few GPIO pins. The Raspberry Pi has no ADC inputs, so I had to find a chip that could do it. Lower amounts of light increase the resistance, and higher amounts of light decrease it, making it impossible to read them digitally.

ww2 online tank

Second, I needed a way to measure the 4 LDRs (variable light resistors) that give a value based on the amount of light hitting them.












Ww2 online tank