I need help wring a python code for my IOT class.
This code will be used on Tinkercad
I am to create a
Blinking LED and Ultrasonic Senor
For this project you will be creating a distance sensor circuit with visual feedback. You will use a Ultrasonic sensor to measure the proximity. An LED will be used to indicate the proximity on an object by blinking fast to close objects, and slow for far away objects. You can use your physical equipment in your kits or you can use the virtual tools to create this circuit and demonstrate it.
Thanks in advance
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
TRIG=23
ECHO=24
GPIO.setup(TRIG,GPIO.OUT)
GPIO.setup(ECHO,GPIO.IN)
try:
while True:
GPIO.output(TRIG, False)
time.sleep(2)
GPIO.ouput(TRIG,
True)
time.sleep(0.00001)
GPIO.output(TRIG, False)
while
GPIO.input(ECHO)==0:
pulse_start =
time.time()
while
GPIO.input(ECHO)==1:
pulse_end =
time.time()
pulse_duration = pluse_end - pulse_start
distance = pulse_duration * 17150
distance =
round(distance,2)
if (distance < 10):
GPIO.output(LedPin, GPIO.LOW) # led on
time.sleep(0.1)
print 'led off...'
GPIO.output(LedPin, GPIO.HIGH) # led off
time.sleep(0.1)
else (distance > 10):
GPIO.output(LedPin, GPIO.LOW) # led on
time.sleep(0.5)
print 'led off...'
GPIO.output(LedPin, GPIO.HIGH) # led off
time.sleep(0.5)
except KeyboardInterrupt:
print("Cleaning up!")
gpio.cleanup()
I need help wring a python code for my IOT class. This code will be used...
Hi I need some help writing a security code using python mongodb restful api. I just need help on how to provide a security login to user to enter their username and password or to have a block in using extra access once they have logined and they want more access to the databases they will be force to sign out of the server but I just do not know how to start on it can someone show me how...
I need help writing a very basic code in python. The code should not be very complicated. The code must have the following things in it: 1. create a function that takes a state and length of characters and makes a license plate and use the function to make a plate based on user input (use the def function and random.choice as well as import random) 2. the license plate should be a mix of random letters and numbers based...
I Need Help with this using Java Programming
:
Class name
fname
lname
Class variable
total Number
Constructor (no arguments)
Constructor (takes two arguments, fname and lname)
One getter method to return the fname and lname
One setter method for fname and lname
Inside Main:
Create three objects with the following
names
Jill Doe
John James
Jack Smith
When creating the first object (Should
not be an anonymous object)
use the argument-less constructor
Then use the setter method to assign...
Hi, I need help writing a code for this. The language is python 3, and we cannot use things like break, continue, exit(), lambda, map, filter, raise, try, except, and assert in our code. Thank you! We must write a function called "binary_to_decimal(binary_number)" that takes a string for a binary number and output the decimal integer for that number. The solution, aka the code, MUST contain a for loop of this form (power is an integer variable you define earlier):...
I need help writing a code for this. It has to be written in
Python. Thank you.
Suppose there is a class A Conditioner. The dass supports the following behaviors: turning the air condition on, off and setting the desired temperature. The following which accept no arguments and return no value, and set temp, which accepts an int argument and returns no value methods are provided for these behaviors: tur n on and turn off There is a reference yariable...
I need help coding this with Python. Create a Point class that consists of an ordered pair (x, y) representing a point's location on the x and y axes. The constructor allow the x and y values to be passed in and should default missing values to 0. You must override the __str__ method to print the point as normal (i.e., "(2, 5)"). Also, create a Line class that consists of a pair of Point objects p and q. A...
Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...
Can someone help me with the main class of my code. Here is the assignment notes. Implement project assignment �1� at the end of chapter 18 on page 545 in the textbook. Use the definition shown below for the "jumpSearch" method of the SkipSearch class. Notice that the method is delcared static. Therefore, you do not need to create a new instance of the object before the method is called. Simply use "SkipSearch.jumpSearch(...)" with the appropriate 4 parameter values. When...
JAVA I. Using the Event Class created previously, create an array of objects; II. Demonstrate passing array reference to a method; III. Demonstrate creating array of objects that prints out only x 0.0 for all objects. PROJECT 5C - ARRAYS Create a new file called " EventArray5C". There are some "challenging" directions in this project. . 1.Prepare a document box (tell me that task(s) the application is to accomplish, how it will accomplish the tasks, the author of...
PLEASE I NEED HELP WITH THIS JAVA CODE Homework 3-3 Create a Driver class to use your Airplane and Passenger classes and create instances of them. In the main method do the following: Create an Airplane that will store up to 100 Passengers Create 5 Passenger Objects with the details specified in the table below Add the 5 Passenger objects to the Airplane Call the printDetails method from the Airplane to print all the Airplane and Passenger details. variable name...