> For the complete documentation index, see [llms.txt](https://docs.revrobotics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.revrobotics.com/classroom-activities/programming-focus/count-by-count.md).

# Count-by-Count Activity

## Introduction

This activity is intended to provide additional practice with using the touch sensor by completing a simple task. Students will build a small servo “gate” regulating the entrance into an area. To raise the gate, the touch sensor must be pressed, but once a max number is pressed no more entries will be allowed.&#x20;

Consider pairing this activity with students building a diorama of their gated area. Examples might include a museum, lunch room, theater, or store. This lesson may also be tied with classes introducing CAD, or safety and accessibility standards for buildings.

<figure><img src="/files/EZEa4RnDfFMjlZTH9Xpd" alt="" width="563"><figcaption><p>Example gate build for the Count-by-Count Activity</p></figcaption></figure>

### Covered Concepts

* Touch Sensor
* If/Else logic
* Loops
* ElapsedTime
* Servo usage
* Programming angular limits on a servo with the SRS Programmer

### Curriculum Connections

* Intro to Robotics V2 - Unit 4, Lesson 25&#x20;
* Intro to Robotics V2 - Unit 5, Lesson 29 (ElapsedTime)

### Activity Goals

Students will:

* Utilize the touch sensor in a practical scenario mimicking a real-life use case
* Practice programming a touch sensor&#x20;
* Create a program that uses a count to track how many times the touch sensor has been pressed and that uses a timer to reset once the max is reached

## Activity Files

### Teacher Files

{% file src="/files/v50FupCDsgfhCMHsNWSy" %}

### Student Files

**Student Activity Worksheet:**

{% file src="/files/sFLu9ADUI92Zu303mZSU" %}

**Programming Guide:**

{% file src="/files/4itlYAkqaXmWZkA4IMKQ" %}

**\[Optional] Programming Guide for two touch sensors:**

{% file src="/files/rRX3NS4O4lpPCJ8JGsfw" %}
