Go to advanced search

by ghp
Sun Mar 11, 2018 8:00 pm
Forum: Scratch
Topic: coding GPIO high/low input pins on Scratch
Replies: 2
Views: 497

Re: coding GPIO high/low input pins on Scratch

Hello, there are two things to solve, get a button press and then play a sound. The example cited from pcmanbob is for scratch1.4 with gpioserver. When using scratch2, then see https://www.raspberrypi.org/blog/scratch-2-raspberry-pi/. For playing sounds, there is an option using scratchclient and so...
by ghp
Sat Feb 17, 2018 4:55 pm
Forum: Scratch
Topic: Sensing Block in Scratch 2.0
Replies: 1
Views: 870

Re: Sensing Block in Scratch 2.0

Hello,
scratch2 is using extensions, which are written in javascript and provide additional blocks controlling the hardware.

With scratchClient it is possible to connect hardware to scratch1.4 or scratch2. See http://heppg.de/ikg/wordpress/?page_id=6 for download.

Hope this helps,
Gerhard
by ghp
Sat Feb 17, 2018 4:48 pm
Forum: Scratch
Topic: 2018: CamJam Edukit3 & Scratch2 EdukitMotorBoard
Replies: 2
Views: 661

Re: 2018: CamJam Edukit3 & Scratch2 EdukitMotorBoard

Hello, I do not own a copy of this kit, but based on the descriptions I have setup a config file for scratchClient config_camjam_edukit.xml ScratchClient works both with scratch1.4 and scratch2 Steps to do: - download scratchClient code distribution from http://heppg.de/ikg/wordpress/?page_id=6 - in...
by ghp
Sun Jan 07, 2018 10:36 am
Forum: Scratch
Topic: Scratch2 Motor Control
Replies: 4
Views: 1263

Re: Scratch2 Motor Control

Hello, scratchClient is supporting scratch2 and allows to use prebuild python adapters for GPIO, PWM, Servo, ADC chips and a lot more. See http://heppg.de/ikg/wordpress/?p=984 for some details. Regards, Gerhard There is an adapter "adapter.gpio.GpioMotorPWM"; sample config is config/config_hbridge_m...
by ghp
Tue Jan 02, 2018 8:06 pm
Forum: Scratch
Topic: Ultrasonic Scratch2
Replies: 2
Views: 1006

Re: Ultrasonic Scratch2

Hello, since a short time scratchClient is supporting scratch2 in addition to scratch1.4. There is an adapter supporting the ultrasonic sensor. See http://heppg.de/ikg/wordpress/?p=984 for a summary. When connecting the ultrasonic HC-SR04, be sure to use level shifters for the output signal. The sen...
by ghp
Sun Dec 17, 2017 5:29 pm
Forum: Python
Topic: Remotely shutting down a pi with another pi
Replies: 10
Views: 801

Re: Remotely shutting down a pi with another pi

Hello, There is another possibility: use linux command ssh pi@192.168.2.123 sudo halt which is easily executed from python command import os os.system('ssh <remote_user>@192.168.2.123 sudo halt') Replace <remote_user> with a valid user on remote machine. Although it looks simple at first glance, you...
by ghp
Mon Dec 04, 2017 6:26 pm
Forum: Scratch
Topic: Launch Scratch game from OS
Replies: 3
Views: 1417

Re: Launch Scratch game from OS

Hello, the script I proposed extends the idea from afmcdnl which looks as if there is already some python script to start scratch2. The added functionality is to have some sort of 'mouse action robot' which presses some buttons in a started scratch2. If you automatically start this combined python s...
by ghp
Sat Dec 02, 2017 8:11 am
Forum: Python
Topic: Assistance with Real time alteration of delay times between multiple lights turning on/off using button inputs
Replies: 4
Views: 388

Re: Assistance with Real time alteration of delay times between multiple lights turning on/off using button inputs

Hello, the proposed waiting-method uses a loop which will increase cpu usage a lot. With a small delay in the loop the cpu usage will be much lower. Timing will be a little bit less accurate, though. Global variables which are read only in a method do not need to be declared as global. def waiting()...
by ghp
Sat Dec 02, 2017 7:34 am
Forum: Python
Topic: Reading temp from 2 separate pi's and updating to central mysql db via python
Replies: 1
Views: 212

Re: Reading temp from 2 separate pi's and updating to central mysql db via python

Hello, you have some options, let each pi connect to the database and store the data. Databases can have multiple remote clients connected. send the data to a central pi. You could use MQTT to send/receive the data, using mosquitto as a MQTT broker. The second option using MQTT would also allow to u...
by ghp
Sun Nov 26, 2017 3:33 pm
Forum: Scratch
Topic: Some errors on using scratchClient with Wedo 2.0
Replies: 9
Views: 2552

Re: Some errors on using scratchClient with Wedo 2.0

Hello,
perhaps your command line is wrong ?
instead of

Code: Select all

(wrong)
sudo python scratchClient -c config_wedo2_complete.xml
try using

Code: Select all

cd ~/scratchClient
sudo python scratchClient.py -c config_wedo2_complete.xml
Hope this helps,
Gerhard
by ghp
Sun Nov 19, 2017 3:59 pm
Forum: Scratch
Topic: Launch Scratch game from OS
Replies: 3
Views: 1417

Re: Launch Scratch game from OS

Hello, did not find a simple way to automate scratch2. What could help is an automated way to move the mouse pointer and click on the screen. This script should have some sort of 'record' capability to get the coordinates from the screen, and a 'play' mode to execute the actions. To keep the complex...
by ghp
Sat Nov 11, 2017 4:44 pm
Forum: Python
Topic: Losing Temperature probe
Replies: 2
Views: 261

Re: Losing Temperature probe

Hello, put the code into a try-except statement: try: tfile = open("/sys/bus/w1/devices/28-0315a4e4e6ff/w1_slave")#yellow ... process data as usual except FileNotFoundError as e: print("ERROR", str(e) ) ... stop heater, send emails, sound a buzzer or whatever needed See also https://docs.python.org/...
by ghp
Fri Nov 10, 2017 6:39 am
Forum: Python
Topic: Finding a Line of GPS data
Replies: 11
Views: 842

Re: Finding a Line of GPS data

Hello,
you can check a line of code with string method startswith:

Code: Select all

import serial
ser=serial.Serial('dev/ttyUSB0',9600)
while 1:
    textln=ser.readline()
    if textln.startswith( '$GPGGA'):
        print (textln)
Good luck with your project !
by ghp
Thu Nov 09, 2017 9:09 pm
Forum: Scratch
Topic: puzzle
Replies: 0
Views: 953

puzzle

scratch can produce nice scenes. Hope you enjoy:
Image
Implemented with scratch1.4.
by ghp
Wed Nov 08, 2017 9:49 pm
Forum: Scratch
Topic: create a block to execute a python script
Replies: 2
Views: 1246

Re: create a block to execute a python script

Hello, with scratchClient, it is possible to start shell scripts. See http://www.heppg.de/download/scratchClient/doc/html/scratchClient.html#scratch.client.adapters.os.command_line This specific adapter does not use parameters. scratchClient is written in python and there are quite a few adapters fo...
by ghp
Tue Oct 17, 2017 8:40 pm
Forum: Scratch
Topic: New Scratch things for Raspbian September 2016
Replies: 26
Views: 10849

Re: New Scratch things for Raspbian September 2016

Hello, I have since long time a DHT11, DHT22 connection to scratch using an atmel328 as a slave processor. http://heppg.de/ikg/wordpress/?p=430 And since short time there is an adapter using pigpiod software. scratchClient supports both scratch1.4 and scratchx, the extension enabled version of scrat...
by ghp
Sun Sep 10, 2017 1:41 pm
Forum: Scratch
Topic: Clock pulse generation using scratch
Replies: 2
Views: 1522

Re: Clock pulse generation using scratch

Hello, MHz clock rates are far beyond the capabilities of scratch. See https://github.com/Guzunty/Pi/tree/master/src/gzlib/src, gz_clock.c or http://abyz.co.uk/rpi/pigpio/examples.html#Misc_minimal_clk for code which uses GPIO4 with the hardware clock generator. I used this feature to drive external...
by ghp
Mon Aug 21, 2017 5:32 am
Forum: Scratch
Topic: Stretch + Scratch 2 + Sense HAT
Replies: 2
Views: 1502

Re: Stretch + Scratch 2 + Sense HAT

Hello, think that the 'sprite to led' function in scratch1.4 is possible because gpioserver is tightly coupled with scratch. In scratch2, the extension system does not have access to sprite pixels. If you need this function, use scratch1.4 which is still available (and I hope it will not be disconti...
by ghp
Sat Aug 19, 2017 6:22 pm
Forum: Scratch
Topic: Scratch 2.0 beginner
Replies: 3
Views: 2301

Re: Scratch 2.0 beginner

Hello,
checked on a pi3 and a piB with same sd-card. Both local scratch2 and web scratch2 run on a pi3, but not on a piB.
Looked to the announcement from the foundation, there is another user who reports problems with pi2.
Most probably the code is only running on the pi3 arm processor.
by ghp
Wed Aug 02, 2017 5:27 pm
Forum: Using Raspberry Pi in the classroom
Topic: Need Advice On School Project
Replies: 1
Views: 2044

Re: Need Advice On School Project

Hello, basically this is not a problem. Install a web server (apache2) on your pi, locate the audio files in the www-folder and put the url to the qr-codes. But the 'student scanning the qr'-part is not clear. Usually there are mobile used for this purpose, but you need to connect the mobile with th...
by ghp
Mon Jul 17, 2017 7:04 pm
Forum: Scratch
Topic: Explorer HAT and Scratch
Replies: 9
Views: 3271

Re: Explorer HAT and Scratch

I am planning on creating a config which combines this adapter with those in the Explorer HAT Pro config as I managed to get the HC-SR04 working plugged in the Explorer HAT Pro yesterday. (I just need to disable Input1 in the config as it is used by the HC-SR04 echo and it works fine) It is one of ...
by ghp
Mon Jul 17, 2017 8:37 am
Forum: Scratch
Topic: Explorer HAT and Scratch
Replies: 9
Views: 3271

Re: Explorer HAT and Scratch

Hello, fixed this HC-SR04 problem. Some other changes are: - For consistency reasons, there is also a change in adapter naming. - As I focus on thread handling since the changes for the scratch2 connections, an issue with thread stopping in the pigpiod connection is also corrected. In the config fil...
by ghp
Mon Jul 10, 2017 4:12 pm
Forum: Scratch
Topic: Explorer HAT and Scratch
Replies: 9
Views: 3271

Re: Explorer HAT and Scratch

Hello, scratchClient can be downloaded from http://heppg.de/ikg/wordpress/?page_id=6 Be sure you have enabled I2C in raspi-config. Follow the install instructions from the web page (should take less than 5 mins) and then cd ~/scratchClient python3 src/scratchClient.py -c explorerhat_pro For instruct...
by ghp
Sun Jul 09, 2017 1:30 pm
Forum: Scratch
Topic: Explorer HAT and Scratch
Replies: 9
Views: 3271

Re: Explorer HAT and Scratch

Hello, tried to reproduce this and using variables to control the outputs on explorer hat doesn't work here too. I maintain scratchClient and so far there was no full support for explorer hat pro. I added support for the capacitive pads, adjusted the ADC code and there is a sample config file now in...
by ghp
Mon Jul 03, 2017 4:04 am
Forum: Scratch
Topic: Release: scratch2 controls GPIO with scratchClient
Replies: 2
Views: 2212

Re: Release: scratch2 controls GPIO with scratchClient

When running experiments with scratch2 'local extensions', I found that the file name proposed by scratch2 on raspbian was project.sbx. Saving worked, but the file was not found directly (needed to use the search function) and content could not be loaded again. There was a conversation on this on bl...

Go to advanced search