0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

学校で貰ったRaspberryPiを動かしてみる

Posted at

初投稿

初めまして、ITの専門学校に通っているKと申します。
就活が嫌すぎて学校でタダで貰ったラズパイを動かしてみることに。

スクリーンショット 2025-01-09 205312.png

調べてみたら2017年制らしい。古い。

動かしてみる

貰ったのは本体だけなので、acアダプターなりsdカードは自腹で揃えました。とりあえずos入れてセットアップ完了。

買った3色LEDでも光らせてみる。

ledctl.py
import tkinter as tk 
from gpiozero import LED

red_led = LED(18)
yel_led = LED(15)
gre_led = LED(14)

def redon():
    yel_led.off()
    gre_led.off()
    red_led.on()
    print("赤色点灯!")

def yelon():
    red_led.off()
    gre_led.off()
    yel_led.on()
    print("黄色点灯!")

def greon():
    red_led.off()
    yel_led.off()
    gre_led.on()
    print("緑色点灯!")

root = tk.Tk()
root.title("TestLED")
root.geometry("300x300")

button1 = tk.Button(root, text="RED",height=2, width=5, command=redon)
button1.place(x=50,y=50)

button2 = tk.Button(root, text="YELLOW",height=2, width=5, command=yelon)
button2.place(x=120,y=50)

button3 = tk.Button(root, text="GREEN",height=2, width=5, command=greon)
button3.place(x=190,y=50)

root.mainloop()

スクリーンショット 2025-01-09 211144.png
スクリーンショット 2025-01-09 211158.png
スクリーンショット 2025-01-09 211214.png

光った。面白い。いい現実逃避になった。
さて、ES書こう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?