Skip to content

Commit

Permalink
regenerated tutorial after ranger update
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaettig committed Sep 8, 2020
1 parent 27bb021 commit 39ff5a4
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions docs/Tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,7 @@ <h4 id="_anwendungsbeispiel_2">6.2.3. Anwendungsbeispiel</h4>
Console console = new Console();
console.promptForExit();

GpioPinDigitalInput pin = gpio.provisionDigitalInputPin(RaspiBcmPin.GPIO_17);
GpioPinDigitalInput pin = gpio.provisionDigitalInputPin(RaspiBcmPin.GPIO_25);
ButtonComponent button = new ButtonComponent(pin);

boolean lastStatePressed = false;
Expand Down Expand Up @@ -2107,7 +2107,7 @@ <h4 id="_anwendungsbeispiel_3">6.3.3. Anwendungsbeispiel</h4>
Console console = new Console();
console.promptForExit();

GpioPinPwmOutput pwm = gpio.provisionPwmOutputPin(RaspiBcmPin.GPIO_12);
GpioPinPwmOutput pwm = gpio.provisionPwmOutputPin(RaspiBcmPin.GPIO_18);
BuzzerComponent buzzer = new BuzzerComponent(pwm);

Note notes[] = { Note.G4, Note.G4, Note.G4, Note.DS4, Note.AS4, Note.G4, Note.DS4, Note.AS4, Note.G4, Note.D5,
Expand Down Expand Up @@ -2535,7 +2535,15 @@ <h4 id="_api_7">6.7.2. API</h4>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">UltraSonicRangerComponent​(GroveAdapter groveAdapter)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Standard Constructor for the Ultra Sonic Ranger that only needs grove hat connection information.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Standard Constructor for the Grove Ultra Sonic Ranger that only needs grove hat connection information.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">UltraSonicRangerComponent​(Pin pin)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Constructor for the Ultrasonic Ranger that uses the same pin for the trigger and the echo</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">UltraSonicRangerComponent​(Pin trigger, Pin echo)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Constructor for using the Grove Ultrasonic Ranger without the Grove Base Hat. This is also compatible with other Ultrasonic Rangers that use different pins for the trigger and the echo</p></td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -2572,7 +2580,14 @@ <h4 id="_anwendungsbeispiel_7">6.7.3. Anwendungsbeispiel</h4>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-java" data-lang="java"> UltraSonicRangerComponent ultraSonicRangerComponent = new UltraSonicRangerComponent(GroveAdapter.D5);
<pre class="highlight"><code class="language-java" data-lang="java"> GpioFactory.setDefaultProvider(new RaspiGpioProvider(RaspiPinNumberingScheme.BROADCOM_PIN_NUMBERING));
final GpioController gpio = GpioFactory.getInstance();

//Ultrasonic Ranger on the CrowPi
GpioPinDigitalInput echo = gpio.provisionDigitalInputPin(RaspiBcmPin.GPIO_12);
GpioPinDigitalInput trigger = gpio.provisionDigitalInputPin(RaspiBcmPin.GPIO_16);

UltraSonicRangerComponent ultraSonicRangerComponent = new UltraSonicRangerComponent(trigger, echo);

//Shows the measured distance every second
while (true) {
Expand Down Expand Up @@ -3805,7 +3820,7 @@ <h4 id="_codierung">7.2.3. Codierung</h4>
.height(1080)
.encoding(Encoding.JPEG)
.quality(85)
.rotation(180);
.rotation(0);
raspberryPiCamera = new RaspberryPiCameraComponent(stillConfig);
}</code></pre>
</div>
Expand All @@ -3816,6 +3831,7 @@ <h4 id="_codierung">7.2.3. Codierung</h4>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-java" data-lang="java"> private void waitForButtonPress() throws InterruptedException {
lcd.clearText();
lcd.displayText("Press Button", 1);
lcd.displayText("To Start!", 2);
Thread.sleep(1000);
Expand Down Expand Up @@ -3958,7 +3974,7 @@ <h4 id="_status_modifizieren">8.1.1. Status modifizieren</h4>
if (dimmable) {
setBrightness(0);
} else {
pin.high();
pin.low();
}

ComponentLogger.logInfo("LedComponent: LED turned off");
Expand Down Expand Up @@ -4404,12 +4420,12 @@ <h4 id="_trigger_signal">8.6.1. Trigger Signal</h4>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-java" data-lang="java"> ComponentLogger.logInfo("UltraSonicRangerComponent: Trigger to measure distance");
Gpio.pinMode(pin, Gpio.OUTPUT);
Gpio.digitalWrite(pin, false);
Gpio.pinMode(triggerPin, Gpio.OUTPUT);
Gpio.digitalWrite(triggerPin, false);
Thread.sleep(0, 2000);
Gpio.digitalWrite(pin, true);
Gpio.digitalWrite(triggerPin, true);
Thread.sleep(0, 10000);
Gpio.digitalWrite(pin, false);</code></pre>
Gpio.digitalWrite(triggerPin, false);</code></pre>
</div>
</div>
</div>
Expand All @@ -4424,15 +4440,15 @@ <h4 id="_echo_messen">8.6.2. Echo messen</h4>
int TIMEOUT = 1000000; //just a large number to avoid an endless loop when there is a device problem

//wait for the pulse to start (ultra sonic wave sent)
while (count &lt; TIMEOUT &amp;&amp; Gpio.digitalRead(pin) == 0)
while (count &lt; TIMEOUT &amp;&amp; Gpio.digitalRead(echoPin) == 0)
count++;

if (count &gt;= TIMEOUT) return 0;
long t1 = microTime();

count = 0;
//wait for the pulse to end (ultra sonic wave received)
while (count &lt; TIMEOUT &amp;&amp; Gpio.digitalRead(pin) == 1)
while (count &lt; TIMEOUT &amp;&amp; Gpio.digitalRead(echoPin) == 1)
count++;
if (count &gt;= TIMEOUT) return 0;
long t2 = microTime();
Expand Down Expand Up @@ -5729,7 +5745,7 @@ <h2 id="_literaturverzeichnis">Literaturverzeichnis</h2>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2020-09-06 11:10:42 +0200
Last updated 2020-09-08 10:39:57 +0200
</div>
</div>
</body>
Expand Down

0 comments on commit 39ff5a4

Please sign in to comment.