This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| raspi [2014/05/15 20:02] – Viga parandatud heikopikner | raspi [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| <code c> | <code c> | ||
| 5+9 | 5+9 | ||
| - | + | print ("Tere Kevad") | |
| - | print („Tere Kevad”) | + | |
| 56/ | 56/ | ||
| - | + | print ("Tere Kevad") | |
| - | print („Tere Kevad”) | + | |
| 3 > 7 | 3 > 7 | ||
| - | |||
| for x in range (1,10): | for x in range (1,10): | ||
| print (x) | print (x) | ||
| Line 25: | Line 20: | ||
| <code c> | <code c> | ||
| + | # -*- coding: utf-8 -*- | ||
| kaal = float(input(" | kaal = float(input(" | ||
| if kaal > 100: | if kaal > 100: | ||
| Line 43: | Line 38: | ||
| import turtle | import turtle | ||
| - | |||
| for i in range(5): | for i in range(5): | ||
| turtle.forward(50) | turtle.forward(50) | ||
| turtle.right(144) | turtle.right(144) | ||
| - | |||
| - | |||
| import turtle | import turtle | ||
| - | |||
| turtle.pencolor("# | turtle.pencolor("# | ||
| for i in range(50): | for i in range(50): | ||
| Line 67: | Line 58: | ||
| import Tkinter as tk | import Tkinter as tk | ||
| - | |||
| class Application(tk.Frame): | class Application(tk.Frame): | ||
| def __init__(self, | def __init__(self, | ||
| Line 73: | Line 63: | ||
| self.pack() | self.pack() | ||
| self.createWidgets() | self.createWidgets() | ||
| - | |||
| def createWidgets(self): | def createWidgets(self): | ||
| self.hi_there = tk.Button(self) | self.hi_there = tk.Button(self) | ||
| Line 79: | Line 68: | ||
| self.hi_there[" | self.hi_there[" | ||
| self.hi_there.pack(side=" | self.hi_there.pack(side=" | ||
| - | |||
| self.QUIT = tk.Button(self, | self.QUIT = tk.Button(self, | ||
| self.QUIT.pack(side=" | self.QUIT.pack(side=" | ||
| - | |||
| def say_hi(self): | def say_hi(self): | ||
| print(" | print(" | ||
| - | |||
| root = tk.Tk() | root = tk.Tk() | ||
| app = Application(master=root) | app = Application(master=root) | ||
| Line 96: | Line 82: | ||
| import RPi.GPIO as GPIO | import RPi.GPIO as GPIO | ||
| import time | import time | ||
| - | |||
| ledPin = 11 | ledPin = 11 | ||
| - | |||
| GPIO.setmode(GPIO.BOARD) | GPIO.setmode(GPIO.BOARD) | ||
| GPIO.setup(ledPin, | GPIO.setup(ledPin, | ||
| - | |||
| while True: | while True: | ||
| GPIO.output(ledPin, | GPIO.output(ledPin, | ||
| Line 115: | Line 98: | ||
| import RPi.GPIO as GPIO | import RPi.GPIO as GPIO | ||
| import time | import time | ||
| - | |||
| sensorPin = 7 | sensorPin = 7 | ||
| - | |||
| GPIO.setmode(GPIO.BOARD) | GPIO.setmode(GPIO.BOARD) | ||
| GPIO.setup(sensorPin, | GPIO.setup(sensorPin, | ||
| - | |||
| - | prevState = False | ||
| - | currState = False | ||
| - | |||
| while True: | while True: | ||
| - | time.sleep(0.1) | + | time.sleep(0.1) |
| - | | + | |
| - | currState = GPIO.input(sensorPin) | + | |
| - | if currState != prevState: | + | |
| - | newState = " | + | |
| - | print "%s, %s" % (newState) | + | |
| </ | </ | ||
| Line 137: | Line 110: | ||
| - lisatakse reale kuupäev ja kellaaeg, ning tulemus kirjutatakse log-i faili. | - lisatakse reale kuupäev ja kellaaeg, ning tulemus kirjutatakse log-i faili. | ||
| - tulemused näidatakse reaalajas graafiliselt (Vihje: Reaalaja graafilise väljundi tekitamiseks | - tulemused näidatakse reaalajas graafiliselt (Vihje: Reaalaja graafilise väljundi tekitamiseks | ||
| + | |||
| + | https:// | ||