Other articles

  1. Python - How to make a voltmeter

    Python based 0 - 55v DVM

    Introduction

    You can not have enough Digital Voltage Multimeters, or some other device that measures voltage. Also, I needed an extra voltage measuring device on my boat. This little project teaches you how to make a PIC16F688 read voltage, convert it to an AD value …

    read more
  2. Python - How to make a QR code image with Python

    This script use Tkinter, Image and pyqrcode to make an image of the text entered in the text field.

    from Tkinter import *
    import Image
    import pyqrcode
    
    ''' Functions '''
    def makeQRCode():
        qr_data = txt_Input.get()
        url = pyqrcode.create(qr_data)
        url.png('url.png', scale = 8)
        img = Image.open('url.png')
        img.show()
    
        print …
    read more
  3. Raspberry Pi - blink a LED.md

    This little program toggles an LED on and off forever.

    import RPi.GPIO as GPIO
    import time
    GPIO.setmode(GPIO.BCM)      # Using PIN function not BOARD number #
    GPIO.setwarnings(False)     # Turning off all warnings #
    
    # Run while-loop forever #
    while True:
        GPIO.setup(19, GPIO.OUT)
        print "Led on"
        GPIO.output(19 …
    read more
  4. How to make a clock in Python

    This little script shows the time in a window.

    '''Import libraries'''
    from Tkinter import *
    import time
    
    '''Define a function'''
    def tick():
        '''Assign current time to time_string'''
        time_string = time.strftime("%H:%M:%S")
    
        '''Update the clock labels text'''
        clock.config(text=time_string)
    
        '''After 200ms run tick'''
        clock.after(200, tick)
    
    '''Make …
    read more
  5. Python - How to load a file and convert it base64

    This python script creates a window with four buttons, two labels and a text widget. The code is fairly good commented and speaks for itself. The coded file will be written as a text file.

    import Tkinter, Tkconstants, tkFileDialog
    from Tkinter import *
    import tkMessageBox
    import base64
    import webbrowser
    
    def exit …
    read more
  6. Raspberry Pi - RPM/Tacho meter

    This little program count the rising edges of an IR sensor connected to GPIO 21.

    import RPi.GPIO as GPIO
    import time
    
    sensor = 21
    
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(sensor, GPIO.IN)
    
    sample = 100
    count = 0
    
    start = 0
    end = 0
    
    def set_start():
        global start
        start = time.time()
    
    
    def set_end …
    read more
  7. Raspberry Pi,2 x 16 LCD and web scraping

    This program log on to a website, and get som information.

    The import block:

    1
    2
    3
    4
    5
    6
    #!/usr/bin/python
    import time
    from time import gmtime, strftime
    import socket
    import Adafruit_CharLCD as LCD
    import requests
    

    Assignment:

    time_counter = 0
    
    lcd_rs  = 25
    lcd_en  = 24
    lcd_d4  = 23
    lcd_d5  = 17
    lcd_d6 …
    read more
  8. How to ftp-upload a file with Python

    This script uploads a file to an FTP server

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    #!/usr/bin/python
    import ftplib
    
    server = 'yourftpserver.something'
    username = 'yourusername'
    password = 'yourpassword'
    
    ftp_connection = ftplib.FTP(server, username, password)
    remote_path = "/home/yourusername/ftp"
    ft_connection.cwd(remote_path)
    fh = open("filetouploadincludepath …
    read more

Page 1 / 1

blogroll

social