<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://w.arbores.tech/w/index.php?action=history&amp;feed=atom&amp;title=Adafruit_Sensors</id>
	<title>Adafruit Sensors - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://w.arbores.tech/w/index.php?action=history&amp;feed=atom&amp;title=Adafruit_Sensors"/>
	<link rel="alternate" type="text/html" href="http://w.arbores.tech/w/index.php?title=Adafruit_Sensors&amp;action=history"/>
	<updated>2026-04-19T07:46:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.11</generator>
	<entry>
		<id>http://w.arbores.tech/w/index.php?title=Adafruit_Sensors&amp;diff=17604&amp;oldid=prev</id>
		<title>Daniel K. Schneider: Created page with &quot;{{syllabus |is_part_of_syllabus=E-textile |do_not_show_sub_page=No |page_previous=Adafruit Sensors |status=to improve |last_modification=2019/10/08 |objective=be aware of vari...&quot;</title>
		<link rel="alternate" type="text/html" href="http://w.arbores.tech/w/index.php?title=Adafruit_Sensors&amp;diff=17604&amp;oldid=prev"/>
		<updated>2021-04-11T11:19:23Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{syllabus |is_part_of_syllabus=E-textile |do_not_show_sub_page=No |page_previous=Adafruit Sensors |status=to improve |last_modification=2019/10/08 |objective=be aware of vari...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{syllabus&lt;br /&gt;
|is_part_of_syllabus=E-textile&lt;br /&gt;
|do_not_show_sub_page=No&lt;br /&gt;
|page_previous=Adafruit Sensors&lt;br /&gt;
|status=to improve&lt;br /&gt;
|last_modification=2019/10/08&lt;br /&gt;
|objective=be aware of various e-textile resources in this wiki,&lt;br /&gt;
basic principles&lt;br /&gt;
|difficulty=beginner&lt;br /&gt;
|see_also=Adafruit Wearables,&lt;br /&gt;
Adafruit Circuit Playground Express,&lt;br /&gt;
MakeCode,&lt;br /&gt;
Adafruit GEMMA,&lt;br /&gt;
Adafruit NeoPixel,&lt;br /&gt;
Adafruit Sensors, &lt;br /&gt;
|cat_syllabus=e-textile&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
In this article,we propose an overview of the [[Adafruit Circuit Playground Express]] (CPX) built-in sensors. This aim of this page is to show you how to leverage them in [[MakeCode]]. So, if you are not familiar with [[MakeCode]], we advise to have a look on [[MakeCode]] page in this wiki.&lt;br /&gt;
&lt;br /&gt;
The CPX built-on sensors available are :&lt;br /&gt;
* Buttons&lt;br /&gt;
* Capacitive touch&lt;br /&gt;
* Light sensor&lt;br /&gt;
* Accelerometer&lt;br /&gt;
* Microphone&lt;br /&gt;
* Switch button&lt;br /&gt;
* Thermometer&lt;br /&gt;
* Infrared Transceiver&lt;br /&gt;
&lt;br /&gt;
= Coding sensors in MakeCode =&lt;br /&gt;
&lt;br /&gt;
In [[MakeCode]], there are two means to read the code : through &amp;#039;&amp;#039;&amp;#039;events&amp;#039;&amp;#039;&amp;#039; or by reading &amp;#039;&amp;#039;&amp;#039;live data&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Events&amp;#039;&amp;#039;&amp;#039;: code runs when an event is detected. For example, the &amp;lt;code&amp;gt;OnShake&amp;lt;/code&amp;gt; event runs code when a certain type of shaking is detected by the accelerometer.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Live data:&amp;#039;&amp;#039;&amp;#039; live reading of the sensor data without a particular event taking place. For example,&amp;lt;code&amp;gt;Rotation&amp;lt;/code&amp;gt; gets a immediate reading from the accelerometer.&lt;br /&gt;
&lt;br /&gt;
You will find below the 2 style of programming with sensors : through &amp;#039;&amp;#039;&amp;#039;events&amp;#039;&amp;#039;&amp;#039; (on left of the picture below) and through &amp;#039;&amp;#039;&amp;#039;live data&amp;#039;&amp;#039;&amp;#039; (on right on the picture below).&lt;br /&gt;
&lt;br /&gt;
[[File:Adafruit event-vs-livedata.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
= Sensors =&lt;br /&gt;
Below, you will find a small presentation each builtin sensors in the CPX.&lt;br /&gt;
&lt;br /&gt;
== Buttons == &lt;br /&gt;
[[File:Circuit playground buttons.jpg|450px|none|left|thumb|Buttons A &amp;amp; B]]&lt;br /&gt;
On the CPX, there are 2 buttons : &amp;lt;code&amp;gt;Button A&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;Button B&amp;lt;/code&amp;gt;. The two buttons could be coded together &amp;lt;code&amp;gt; Button A + B&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Event : the &amp;lt;code&amp;gt;OnEvent&amp;lt;/code&amp;gt; block allows to respond to action (click, long click and other events. &lt;br /&gt;
; Live data : the button can be read in live by using the input &amp;lt;code&amp;gt;[https://makecode.adafruit.com/reference/input/button/is-pressed IsPressed]&amp;lt;/code&amp;gt; that is to say the code check if the button is pressed. You can also used the input &amp;lt;code&amp;gt;[https://makecode.adafruit.com/reference/input/button/was-pressed WasPressed]&amp;lt;/code&amp;gt; in situations in which the program have a risk to busy when the user clicked. In this case, the code check if the button was clicked earlier.&lt;br /&gt;
&lt;br /&gt;
Example :&lt;br /&gt;
The click on button A is used to play a sound. The state of button A is checked in a forever loop to switch between red (if button A is pressed) and green (if nothing happens).&lt;br /&gt;
&lt;br /&gt;
== Capacitive touch == &lt;br /&gt;
&lt;br /&gt;
[[File:Circuit playground captouch.jpg|450px|none|left|thumb|Capacitive touch pins]]&lt;br /&gt;
&lt;br /&gt;
On the CPX, there are 7 capacitive pins (A1, A2, A3, A4, A5, A6 and A7). They can be used as buttons (like buttons A or B). &lt;br /&gt;
; Event : The pins can be used as touch inputs, the code use them like buttons. Instead of saying &amp;lt;code&amp;gt;Button A&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;Button B&amp;lt;/code&amp;gt; as the input source, use a pin name like &amp;lt;code&amp;gt;A1&amp;lt;/code&amp;gt;.&lt;br /&gt;
; Live data : you can read the live button status using input &amp;lt;code&amp;gt;[https://makecode.adafruit.com/reference/input/button/is-pressed IsPressed]&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;[https://makecode.adafruit.com/reference/input/button/was-pressed WasPressed]&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Example : &lt;br /&gt;
An event on pin A4 is used to show pixels animation and the state of pin A7 is checked in a forever loop to switch between blue or red on the neopixels.&lt;br /&gt;
&lt;br /&gt;
== Light sensor == &lt;br /&gt;
&lt;br /&gt;
[[File:Circuit playground lightsensor.jpg|450px|none|left|thumb|Light sensor]]&lt;br /&gt;
&lt;br /&gt;
On the CPX, you have 1 light sensor which allows to run code when the brithgness change.&lt;br /&gt;
&lt;br /&gt;
; Event : By using the [https://makecode.adafruit.com/reference/input/on-light-condition-changed &amp;lt;code&amp;gt; on light&amp;lt;/code&amp;gt;] condition, the sensor allows to run code.&lt;br /&gt;
; Live data : The [https://makecode.adafruit.com/reference/input/light-level &amp;lt;code&amp;gt; light level &amp;lt;/code&amp;gt;] returns the light intensity : from 0 (no light) to 255 (max light).&lt;br /&gt;
&lt;br /&gt;
Example : &lt;br /&gt;
Using the &amp;lt;code&amp;gt;on light &amp;lt;/code&amp;gt; event to run a sparkle animation.&lt;br /&gt;
&lt;br /&gt;
== Accelerometer ==&lt;br /&gt;
&lt;br /&gt;
The CPX has one accelerometer that runs code when acceleration happens on axes X (left to right), Y (bottom to top), Z (aligned with the gravity). Please see the picture below.&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Adafruit-cpx-accelerometer.jpeg|thumb|450px|Accelerometer]]&lt;br /&gt;
|[[File:Adafruit-axis.jpg|thumb|400px|x, y, z axis]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
; Events: The input &amp;lt;code&amp;gt;[https://makecode.adafruit.com/reference/input/on-gesture on Gesture] &amp;lt;/code&amp;gt; enable to program adafruit to run a code folowing a certain event such shake, freefall or orientation events. &lt;br /&gt;
&lt;br /&gt;
; Live data : an &amp;lt;code&amp;gt;[https://makecode.adafruit.com/reference/input/acceleration acceleration]&amp;lt;/code&amp;gt; input can return the acceleration value (in milli-g, e.g 1/1000 of a g) according to direction (on x, y or z axis) or the combined force in all directions.&lt;br /&gt;
&lt;br /&gt;
Example : &lt;br /&gt;
Using a shake to play a sound (event). A forever loop can display the accelerometer reading (live data).&lt;br /&gt;
&lt;br /&gt;
== Microphone == &lt;br /&gt;
[[File:Circuit playground microphone.jpg|450px|none|thumb|450px|Microphone]]&lt;br /&gt;
&lt;br /&gt;
The CPX has one microphone that runs code when a sound happens.  &lt;br /&gt;
&lt;br /&gt;
; Events: The &amp;lt;code&amp;gt;[https://makecode.adafruit.com/reference/input/on-loud-sound on loud sound] &amp;lt;/code&amp;gt; event detect a peak in the sound level, e.g a hand clapping. You can change the lound treshold by using the &amp;#039;&amp;#039;set sound to sound level&amp;#039;&amp;#039; (e.g https://learn.adafruit.com/make-it-sense/makecode-3). &lt;br /&gt;
&lt;br /&gt;
; Live data :  The sounf level block return the sound intensity from silent (0) to 255 (very loud). &lt;br /&gt;
&lt;br /&gt;
Example : An sound variation can play a music; a forever loop can continuously display the sound level.&lt;br /&gt;
&lt;br /&gt;
== Switch button ==&lt;br /&gt;
&lt;br /&gt;
[[File:Circuit playground switch.jpg|450px|none|left|thumb|Switch button]]&lt;br /&gt;
&lt;br /&gt;
The CPX has one switch button which have 2 positions : left or right. This button can be very useful to create some on/off programs.&lt;br /&gt;
&lt;br /&gt;
; Event : The &amp;lt;code&amp;gt; on switch moved &amp;lt;/code&amp;gt; input enable to run code when the switch button is moved to the left position or to the right position.&lt;br /&gt;
&lt;br /&gt;
; Live data : The &amp;lt;code&amp;gt; switch right &amp;lt;/code&amp;gt; block (in input) indicates if the switch is on the right position. &lt;br /&gt;
&lt;br /&gt;
Example : events can be play different animations if the switch button is on the left or on the right (event). A forever loop can play an animation if the switch is on the right position and no animation if the switch is on the left (live data).&lt;br /&gt;
&lt;br /&gt;
== Thermometer == &lt;br /&gt;
&lt;br /&gt;
[[File:Circuit playground temp.jpg|450px|none|left|thumb|Thermometer]]&lt;br /&gt;
&lt;br /&gt;
The CPX has a thermometer that can track the ambient temperature (in Celcius or Fahrenheit degrees).&lt;br /&gt;
&lt;br /&gt;
; Events: The event &amp;lt;code&amp;gt; [https://makecode.adafruit.com/reference/input/on-temperature-condition-changed on temperature] (condition changed) &amp;lt;/code&amp;gt; runs code when temperature changes from hot to cold or from cold to hot. &lt;br /&gt;
&lt;br /&gt;
; Live data : The &amp;lt;code&amp;gt; [https://makecode.adafruit.com/reference/input/temperature temperature block] &amp;lt;/code&amp;gt; return the current temperature by checking how hot its computer chips are.&lt;br /&gt;
&lt;br /&gt;
Exmample : If the temperature change over 15°C, a sound is playing. A forever loop can graphs the current temperature using the LEDs over 20°C.&lt;br /&gt;
&lt;br /&gt;
== Infrared transceiver == &lt;br /&gt;
&lt;br /&gt;
[[File:Sensors infrared.jpg|450px|none|left|thumb|Infrared transceiver]]&lt;br /&gt;
&lt;br /&gt;
The CPX have an onboard infrared transceiver (i.e transmitter and receiver) which allow to communicate data between CPXs.&lt;br /&gt;
&lt;br /&gt;
; Events: An event happens when the &amp;lt;code&amp;gt; [https://makecode.adafruit.com/reference/network/on-infrared-received-number On infrared received] &amp;lt;/code&amp;gt; receive number.&lt;br /&gt;
&lt;br /&gt;
Example : &lt;br /&gt;
A RVB (i.e number) color can be sent over IR to turn on the neopixel remotely.&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
&lt;br /&gt;
; At Adafruit : &lt;br /&gt;
* [https://learn.adafruit.com/sensors-in-makecode/overview Sensors in MakeCode]&lt;br /&gt;
* [https://makecode.adafruit.com/behind-the-makecode-hardware Behind the MakeCode Hardware]&lt;br /&gt;
&lt;br /&gt;
= Aknowledgement =&lt;br /&gt;
Pictures as well as some text was reproduced from the Adafruit circuit playground express documentation. Some pictures are available under a CC BY-NC-SA license. Others are copyright AdaFruit and &amp;quot;all rights reserved&amp;quot; and reproduced with permission. Before you reuse any picture from this website, make sure to look at the license information.&lt;br /&gt;
&lt;br /&gt;
For more information about using Adafruit, see https://learn.adafruit.com.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:E-textile]]&lt;/div&gt;</summary>
		<author><name>Daniel K. Schneider</name></author>
	</entry>
</feed>