diff --git a/tutorials/01-time/index.md b/tutorials/01-time/index.md index bdcd283..5b49d52 100644 --- a/tutorials/01-time/index.md +++ b/tutorials/01-time/index.md @@ -5,63 +5,7 @@ has_children: false parent: "Tutorials" --- -# Dealing with Time in Circuit Python - Coding Seminar - -# **Modules and Libraries in Circuit Python** - -*****************For more information on Modules and Libraries also see the [FAQ section](https://www.notion.so/FAQ-4d1e68a1814b4fd890f08981efcf8a1b) on this page.* - -- Modules and libraries are handled quite similarly in many ways. A library will often (maybe always?) be a collection of modules. -- Some **Libraries** also come bundled with the (Circuit)Python installation, and you can see what's on your ItsyBitsy by exploring the file structure. -- If you need to add a **Library** that you don't already have, it's a fairly simple case of downloading it and then copying it to the correct place in the ItsyBitsy file structure. Check the **reference documentation** if you need more help on doing this. -- In order to **use** a **Module** (even a Core Module) or a **Library** that has been installed on your device, you still need to "add it" in each session. This can be done in the (Circuit)Python Console, if you're working there, or in the .py file if you're writing one. This is done using the **import** command. (See example below) - - ```jsx - import time - ``` - - -## The Import Command - -*****************For more information on Modules and Libraries also see the [FAQ section](https://www.notion.so/FAQ-4d1e68a1814b4fd890f08981efcf8a1b) on this page.* - -- The basic way of doing this is to simply write "**import module_name**" or "**import library_name**" (note that you do this with no file extension, so no ".py" on the name) -- Some modules have pretty long names, and generally in order to use any of the functionality you have to type the name (among other things...). For this reason, there's an option to "**import long_module_name as short_name**" or "**import long_library_name as short_name**". - - So instead of: - - ```jsx - import digitalio - - button = digitalio.DigitalInOut(board.D13) - ``` - - You can write: - - ```python - import digitalio as dig - - #Now you can refer to ‘digitalio’ with just ‘dig’ - button = dig.DigitalInOut(board.D13) - ``` - -- There is also the option to import only certain functions, constants etc. from a module or library. This is done using the "**from module import function"** syntax e.g. "**from math import sin**". One of the main benefits of doing this is also short-hand. If you import the whole math module, then to use sin you have to write "**math.sin(something)**". If you use the "from" approach above, then you can just do "**sin(something)**" - - ```jsx - import usb_hid - from adafruit_hid.keyboard import Keyboard - ``` - - -## **Finding out what’s in a Module or Library** - -*****************For more information on Modules and Libraries also see the FAQ section on this page.***************** - -- While you would often want to check documentation online, it can sometimes be quite useful to interrogate the functionality offered by a module or library from within (Circuit)Python. -- This can be done from the (Circuit)Python console. First you import the thing you want to use e.g. "**import math**", then you have two options: - - Typing "**dir(math)**" will simply give you a list of the functions and values 'inside' it - - Typing "**help(math)**" will give you a much longer answer, that actually describes all the functions and values and what they do. - - As a compromise, you also have the option to see the list of things using "**dir()**", and then find out a bit more about it by using "help()". For example, you could write "**help(math.sin)**" to find out about the sin function specifically. +# Dealing with Time in Circuit Python # **Time in Circuit Python** @@ -338,5 +282,3 @@ while True: # Set the LED state according to the value of LEDstate. led.value = LEDstate ``` - -[FAQ](https://www.notion.so/FAQ-4d1e68a1814b4fd890f08981efcf8a1b) \ No newline at end of file diff --git a/tutorials/01-pomodoro/assets/pomodoro-states.png b/tutorials/02-pomodoro/assets/pomodoro-states.png similarity index 100% rename from tutorials/01-pomodoro/assets/pomodoro-states.png rename to tutorials/02-pomodoro/assets/pomodoro-states.png diff --git a/tutorials/01-pomodoro/index.md b/tutorials/02-pomodoro/index.md similarity index 90% rename from tutorials/01-pomodoro/index.md rename to tutorials/02-pomodoro/index.md index fd04ecb..f7f8960 100644 --- a/tutorials/01-pomodoro/index.md +++ b/tutorials/02-pomodoro/index.md @@ -1,11 +1,11 @@ --- layout: default -title: "01 Pomodoro" +title: "02 Pomodoro" has_children: true parent: "Tutorials" --- -# 01 Pomodoro Timer +# 02 Pomodoro Timer In this tutorial, you will learn how to build a Pomodoro Timer. The Pomodoro Technique is a time management technique that allows you to take regular breaks when working on a task. We will use CircuitPython as programming language, and use Mu Editor as our programming environment. diff --git a/tutorials/01-pomodoro/step1.md b/tutorials/02-pomodoro/step1.md similarity index 98% rename from tutorials/01-pomodoro/step1.md rename to tutorials/02-pomodoro/step1.md index 79a8e3c..c3cd257 100644 --- a/tutorials/01-pomodoro/step1.md +++ b/tutorials/02-pomodoro/step1.md @@ -1,7 +1,7 @@ --- layout: default title: "Step 1: Preparation" -parent: "01 Pomodoro" +parent: "02 Pomodoro" grand_parent: "Tutorials" --- diff --git a/tutorials/01-pomodoro/step2-code.md b/tutorials/02-pomodoro/step2-code.md similarity index 100% rename from tutorials/01-pomodoro/step2-code.md rename to tutorials/02-pomodoro/step2-code.md diff --git a/tutorials/01-pomodoro/step2.md b/tutorials/02-pomodoro/step2.md similarity index 99% rename from tutorials/01-pomodoro/step2.md rename to tutorials/02-pomodoro/step2.md index d34f4e2..ab4ca8f 100644 --- a/tutorials/01-pomodoro/step2.md +++ b/tutorials/02-pomodoro/step2.md @@ -1,7 +1,7 @@ --- layout: default title: "Step 2: Setting up the states" -parent: "01 Pomodoro" +parent: "02 Pomodoro" grand_parent: "Tutorials" --- diff --git a/tutorials/01-pomodoro/step3-code.md b/tutorials/02-pomodoro/step3-code.md similarity index 100% rename from tutorials/01-pomodoro/step3-code.md rename to tutorials/02-pomodoro/step3-code.md diff --git a/tutorials/01-pomodoro/step3.md b/tutorials/02-pomodoro/step3.md similarity index 99% rename from tutorials/01-pomodoro/step3.md rename to tutorials/02-pomodoro/step3.md index 480aaed..ce2932d 100644 --- a/tutorials/01-pomodoro/step3.md +++ b/tutorials/02-pomodoro/step3.md @@ -1,7 +1,7 @@ --- layout: default title: "Step 3: Adding the LED" -parent: "01 Pomodoro" +parent: "02 Pomodoro" grand_parent: "Tutorials" --- diff --git a/tutorials/01-pomodoro/step4-code.md b/tutorials/02-pomodoro/step4-code.md similarity index 100% rename from tutorials/01-pomodoro/step4-code.md rename to tutorials/02-pomodoro/step4-code.md diff --git a/tutorials/01-pomodoro/step4.md b/tutorials/02-pomodoro/step4.md similarity index 99% rename from tutorials/01-pomodoro/step4.md rename to tutorials/02-pomodoro/step4.md index 5bee49a..9949883 100644 --- a/tutorials/01-pomodoro/step4.md +++ b/tutorials/02-pomodoro/step4.md @@ -1,7 +1,7 @@ --- layout: default title: "Step 4: Creating a timer" -parent: "01 Pomodoro" +parent: "02 Pomodoro" grand_parent: "Tutorials" --- diff --git a/tutorials/01-pomodoro/step5-code.md b/tutorials/02-pomodoro/step5-code.md similarity index 100% rename from tutorials/01-pomodoro/step5-code.md rename to tutorials/02-pomodoro/step5-code.md diff --git a/tutorials/01-pomodoro/step5.md b/tutorials/02-pomodoro/step5.md similarity index 99% rename from tutorials/01-pomodoro/step5.md rename to tutorials/02-pomodoro/step5.md index cdacda0..6981f0d 100644 --- a/tutorials/01-pomodoro/step5.md +++ b/tutorials/02-pomodoro/step5.md @@ -1,7 +1,7 @@ --- layout: default title: "Step 5: Adding an alarm" -parent: "01 Pomodoro" +parent: "02 Pomodoro" grand_parent: "Tutorials" --- diff --git a/tutorials/01-pomodoro/step6-code.md b/tutorials/02-pomodoro/step6-code.md similarity index 100% rename from tutorials/01-pomodoro/step6-code.md rename to tutorials/02-pomodoro/step6-code.md diff --git a/tutorials/01-pomodoro/step6.md b/tutorials/02-pomodoro/step6.md similarity index 99% rename from tutorials/01-pomodoro/step6.md rename to tutorials/02-pomodoro/step6.md index 7ce9125..f5516a0 100644 --- a/tutorials/01-pomodoro/step6.md +++ b/tutorials/02-pomodoro/step6.md @@ -1,7 +1,7 @@ --- layout: default title: "Step 6: Adding the breaks" -parent: "01 Pomodoro" +parent: "02 Pomodoro" grand_parent: "Tutorials" --- diff --git a/tutorials/01-pomodoro/step7-code.md b/tutorials/02-pomodoro/step7-code.md similarity index 100% rename from tutorials/01-pomodoro/step7-code.md rename to tutorials/02-pomodoro/step7-code.md diff --git a/tutorials/01-pomodoro/step7.md b/tutorials/02-pomodoro/step7.md similarity index 98% rename from tutorials/01-pomodoro/step7.md rename to tutorials/02-pomodoro/step7.md index 3274edb..bd64e40 100644 --- a/tutorials/01-pomodoro/step7.md +++ b/tutorials/02-pomodoro/step7.md @@ -1,7 +1,7 @@ --- layout: default title: "Step 7: Additional visualization using the servo" -parent: "01 Pomodoro" +parent: "02 Pomodoro" grand_parent: "Tutorials" --- diff --git a/tutorials/01-pomodoro/step8.md b/tutorials/02-pomodoro/step8.md similarity index 94% rename from tutorials/01-pomodoro/step8.md rename to tutorials/02-pomodoro/step8.md index b105344..1f1d486 100644 --- a/tutorials/01-pomodoro/step8.md +++ b/tutorials/02-pomodoro/step8.md @@ -1,7 +1,7 @@ --- layout: default title: Step 8 Assembling the embodiment -parent: "01 Pomodoro" +parent: "02 Pomodoro" grand_parent: "Tutorials" ---