Ciberneitor
Posts: 5
Joined: Fri Jan 12, 2018 9:39 am

I need someone make my code

Fri Jan 12, 2018 9:47 am

:roll: Hi dudes :roll:
I’m making a project and I need a software for my raspberry. These are the specifications for the code. I’ll use a ultrasound sensor. I need that when the sensor detects something in one meter, a buzzer starts making noise. When it is to 75cm to make the noise faster, in 50cm the noise gets faster, in 25cm even faster and in 10cm, it starts making noise and doesn’t stop untill it’s further. More or less like a car’s sensor.

Thanks if you help me.

jahboater
Posts: 2782
Joined: Wed Feb 04, 2015 6:38 pm

Re: I need someone make my code

Fri Jan 12, 2018 10:31 am

The Raspberry Pi is all about education.

Consider learning how to do this yourself, it will be great fun and satisfying, and you will have gained a lot. The software is an integral part of any Pi project.

If you get really stuck, come here and ask specific questions about any problems in your code.

Ciberneitor
Posts: 5
Joined: Fri Jan 12, 2018 9:39 am

Re: I need someone make my code

Fri Jan 12, 2018 11:29 am

I know, but I don’t have time to learn. Please, make my code. I absolutelly need it. I’m not trying to learn. I need the code for a work. I just need a code for a work that will chage lots of people’s lifes. Please I need the code urgently.

User avatar
DougieLawson
Posts: 33348
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: I need someone make my code

Fri Jan 12, 2018 12:04 pm

https://projects.raspberrypi.org/en/pro ... t-detector

You should be able to glue that together with

https://projects.raspberrypi.org/en/pro ... r-tripwire

To make what you want. All the code is written for you, you'll just have to work out how to combine those two educational projects.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

scotty101
Posts: 2987
Joined: Fri Jun 08, 2012 6:03 pm

Re: I need someone make my code

Fri Jan 12, 2018 12:05 pm

Ciberneitor wrote:
Fri Jan 12, 2018 11:29 am
I know, but I don’t have time to learn. Please I need the code urgently.
:roll:
Then you'll need to throw some money at the problem and pay someone to do it for you. If this is for 'a work' then presumably you are being paid to do this.
People on this forum are happy to support people who are learning and even sometime help out with some code examples but are typically less willing to do free work for people.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20064
Joined: Sat Jul 30, 2011 7:41 pm

Re: I need someone make my code

Fri Jan 12, 2018 12:56 pm

Ciberneitor wrote:
Fri Jan 12, 2018 11:29 am
I know, but I don’t have time to learn. Please, make my code. I absolutelly need it. I’m not trying to learn. I need the code for a work. I just need a code for a work that will chage lots of people’s lifes. Please I need the code urgently.
Making a product? Expect to pay someone to develop that product for you.

Want to do it for free? Learn how to do it for free.


Need it for a school/college project?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

User avatar
bensimmo
Posts: 2991
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: I need someone make my code

Fri Jan 12, 2018 2:06 pm

Either way you'll need to learn a bit.
Gpiozero has done most of the work for you, you just need to plug the coding connections together.
The problem you will find is you need to know the code as nobody but you can get the distances correct from trial and alterations.

W. H. Heydt
Posts: 8653
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: I need someone make my code

Fri Jan 12, 2018 4:14 pm

Ciberneitor wrote:
Fri Jan 12, 2018 11:29 am
I know, but I don’t have time to learn. Please, make my code. I absolutelly need it. I’m not trying to learn. I need the code for a work. I just need a code for a work that will chage lots of people’s lifes. Please I need the code urgently.
Contract programming rates these days probably *start* at around $120 per hour. If you need it for work, ask your boss for a budget to hire a programmer.

Edit to add... Asking someone to volunteer their time and effort for your commercial product isn't going to win any friends. Asking someone to volunteer to do the work for a school project defeats the enter point of a school project. Asking anyone to do either of these things immediately on a short deadline is cheek that is just beyond the pale. (Shall I quote W. S. Gilbert?)

Ciberneitor
Posts: 5
Joined: Fri Jan 12, 2018 9:39 am

Re: I need someone make my code

Mon Jan 15, 2018 9:12 am

Please, I need it for a school project.

User avatar
bensimmo
Posts: 2991
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: I need someone make my code

Mon Jan 15, 2018 9:30 am

Have you had a go at the links posted, that 2 days of trying & learning, what have you come up with (what scool age level project is this, only approx needed?)
The people at RaspberryPi have done an excellent job of making it easy to get into with GpioZero.
One link missed out is this https://projects.raspberrypi.org/en/pro ... c-theremin as it uses and pretty much shows you waht you need for the Ultrasonic sensor. work through it and alter it to your needs.


You may even be able to do it in Scratch https://projects.raspberrypi.org/en/pro ... th-scratch

User avatar
PeterO
Posts: 4212
Joined: Sun Jul 22, 2012 4:14 pm

Re: I need someone make my code

Mon Jan 15, 2018 10:01 am

Ciberneitor wrote:
Mon Jan 15, 2018 9:12 am
Please, I need it for a school project.
While your honesty is laudable, we are not here to do your homework/school project for you.

We are here to help you learn things so that you can do it for yourself.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
DougieLawson
Posts: 33348
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: I need someone make my code

Mon Jan 15, 2018 2:03 pm

Ciberneitor wrote:
Mon Jan 15, 2018 9:12 am
Please, I need it for a school project.
I'll do it for GBP £100.00 per hour + VAT @20%

But I won't do your homework for free unless you can arrange for me to get your diploma, exam results, degree (or whatever you're studying for).

I gave you a massive hint here: viewtopic.php?f=91&t=202289&p=1257692#p1257766
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

W. H. Heydt
Posts: 8653
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: I need someone make my code

Mon Jan 15, 2018 5:05 pm

Ciberneitor wrote:
Mon Jan 15, 2018 9:12 am
Please, I need it for a school project.
In addition to the other points that have been made (mostly that doing your homework for you doesn't help you to learn and is--thus--counterproductive), putting your project off to the last minute and then expecting someone else to bail you out by doing all the real work may cause you to panic, but it doesn't instill any urgency on the part of anyone else.

Doing school projects is supposed to teach you things. It is also supposed to build on what you have already learned. So either you have procrastinated until it is too late to learn what you need to learn to do the project, or you have bitten off more than you can chew. I think you need to sit down with your instructor and either ask for more time (you might get *some*), drastically scale back the scope of your project, or just admit you have wasted your own (and his) time on the course and take you lumps on the grade.

In any case, this should be a good lesson in planning and time management.

Ciberneitor
Posts: 5
Joined: Fri Jan 12, 2018 9:39 am

Re: I need someone make my code

Fri Jan 19, 2018 9:16 am

Hello guys, at the end, I made my own code, but at least, could someone correct it?
——————————————————————————————————————————————————————————————

Code: Select all

import RPi.GPIO as GPIO    #Importamos la librería GPIO
import time                #Importamos time (time.sleep)
GPIO.setmode(GPIO.BCM)     #Ponemos la placa en modo BCM
GPIO_TRIGGER = 25          #Usamos el pin GPIO 25 como TRIGGER
GPIO_ECHO    = 7           #Usamos el pin GPIO 7 como ECHO
GPIO.setup(GPIO_TRIGGER,GPIO.OUT)  #Configuramos Trigger como salida
GPIO.setup(GPIO_ECHO,GPIO.IN)      #Configuramos Echo como entrada
GPIO.output(GPIO_TRIGGER,False)    #Ponemos el pin 25 como LOW
GPIO.setup(1, GPIO.OUT)

try:
    while True:     #Iniciamos un loop infinito
        GPIO.output(GPIO_TRIGGER,True)   #Enviamos un pulso de ultrasonidos
        time.sleep(0.00001)              #Una pequeñña pausa
        GPIO.output(GPIO_TRIGGER,False)  #Apagamos el pulso
        start = time.time()              #Guarda el tiempo actual mediante time.time()
        while GPIO.input(GPIO_ECHO)==0:  #Mientras el sensor no reciba señal...
            start = time.time()          #Mantenemos el tiempo actual mediante time.time()
        while GPIO.input(GPIO_ECHO)==1:  #Si el sensor recibe señal...
            stop = time.time()           #Guarda el tiempo actual mediante time.time()        elapsed = stop-start             #Obtenemos el tiempo transcurrido entre envío
        distance = (elapsed * 34300)/2   #D = (T x V)/2
        time.sleep(1)                    #Pequeña pausa para no saturar el procesador

try:
    while True
        if Distance <= 0,001
            MakeSound = 1
            SetSound = 1
        else Distance <= 0,0005
            SetSound = 2
        elif Distance <= 0,00025
            SetSound = 3
        elif Distance <= 0,0001
            SetSound = 4
        elif Distance > 0,001
            MakeSound = 0

    while MakeSound = 1
        if SetSound = 1
            GPIO.output (1, True)
            sleep (5)
            GPIO.output (1, False)
            sleep (5)
        if SetSound = 2
            GPIO.output (1, True)
            sleep (3)
            GPIO.output (1, False)
            sleep (3)
        if SetSound = 3
            GPIO.output (1, True)
            sleep (2)
            GPIO.output (1, False)
            sleep (2)
        if SetSound = 4
            GPIO.output (1, True)
         

User avatar
bensimmo
Posts: 2991
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: I need someone make my code

Fri Jan 19, 2018 9:21 am

Could you repost the code, bit with the CODE tags aorund it to preseve you're much needed python whitespace and indenting.
The tags are in teh editing toolbar. (and an explanation if you hi the BBCode is ON link, at least on the none mobile site app.php/help/bbcode#f2r1 )

PiGraham
Posts: 3320
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: I need someone make my code

Fri Jan 19, 2018 9:44 am

Ciberneitor wrote:
Fri Jan 12, 2018 9:47 am
:roll: Hi dudes :roll:
I’m making a project and I need a software for my raspberry. These are the specifications for the code. I’ll use a ultrasound sensor. I need that when the sensor detects something in one meter, a buzzer starts making noise. When it is to 75cm to make the noise faster, in 50cm the noise gets faster, in 25cm even faster and in 10cm, it starts making noise and doesn’t stop untill it’s further. More or less like a car’s sensor.

Thanks if you help me.
Do you know you can buy something that does that for less than the cost of a Pi & accessories?
https://www.ebay.co.uk/sch/i.html?_from ... r&_sacat=0

pcmanbob
Posts: 4090
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: I need someone make my code

Fri Jan 19, 2018 12:27 pm

Wll looking at your code you have 3 while loops.

The first one getting the distance from the sensor which runs first so it means you will never get to the second on which checks the distance and sets the sound and never ever get the the third one that actually plays the sound' I don't see the point of using try: as you are not trapping any errors and finally you have your elif else statements in the wrong order.

so removing 1 of the while statements and replacing the other with an if statement, correcting the order of the elif/else statements we end up with this.

Code: Select all

import RPi.GPIO as GPIO    #Importamos la librería GPIO
import time                #Importamos time (time.sleep)
GPIO.setmode(GPIO.BCM)     #Ponemos la placa en modo BCM
GPIO_TRIGGER = 25          #Usamos el pin GPIO 25 como TRIGGER
GPIO_ECHO    = 7           #Usamos el pin GPIO 7 como ECHO
GPIO.setup(GPIO_TRIGGER,GPIO.OUT)  #Configuramos Trigger como salida
GPIO.setup(GPIO_ECHO,GPIO.IN)      #Configuramos Echo como entrada
GPIO.output(GPIO_TRIGGER,False)    #Ponemos el pin 25 como LOW
GPIO.setup(1, GPIO.OUT)


while True:     #Iniciamos un loop infinito
    GPIO.output(GPIO_TRIGGER,True)   #Enviamos un pulso de ultrasonidos
    time.sleep(0.00001)              #Una pequeñña pausa
    GPIO.output(GPIO_TRIGGER,False)  #Apagamos el pulso
    start = time.time()              #Guarda el tiempo actual mediante time.time()
    while GPIO.input(GPIO_ECHO)==0:  #Mientras el sensor no reciba señal...
        start = time.time()          #Mantenemos el tiempo actual mediante time.time()
    while GPIO.input(GPIO_ECHO)==1:  #Si el sensor recibe señal...
        stop = time.time()           #Guarda el tiempo actual mediante time.time()        elapsed = stop-start             #Obtenemos el tiempo transcurrido entre envío
    distance = (elapsed * 34300)/2   #D = (T x V)/2
    time.sleep(1)                    #Pequeña pausa para no saturar el procesador



    if Distance <= 0,001
        MakeSound = 1
        SetSound = 1
    elif Distance <= 0,0005
        SetSound = 2
    elif Distance <= 0,00025
        SetSound = 3
    elif Distance <= 0,0001
        SetSound = 4
    else Distance > 0,001
        MakeSound = 0

    if MakeSound = 1
        if SetSound = 1
            GPIO.output (1, True)
            sleep (5)
            GPIO.output (1, False)
            sleep (5)
        if SetSound = 2
            GPIO.output (1, True)
            sleep (3)
            GPIO.output (1, False)
            sleep (3)
        if SetSound = 3
            GPIO.output (1, True)
            sleep (2)
            GPIO.output (1, False)
            sleep (2)
        if SetSound = 4
            GPIO.output (1, True)
         
you may also need to move the time.sleep at the end if the sensor interrogation part of the loop to a point were it is only called if no sound is to be played.

PLEASE NOTE posted code has not been tested it may included errors.
Remember we want information.......................no information no help
The use of crystal balls & mind reading is not supported

Ciberneitor
Posts: 5
Joined: Fri Jan 12, 2018 9:39 am

Re: I need someone make my code

Fri Jan 19, 2018 2:12 pm

Ok, thanks. :D have a good day

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 10709
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: I need someone make my code

Fri Jan 19, 2018 4:38 pm

Banned the OP (ciberneitor) for making personal attacks.

Return to “Beginners”

Who is online

Users browsing this forum: Bing [Bot], calleblyh and 57 guests