//
//  Licensed to the Apache Software Foundation (ASF) under one or more
//  contributor license agreements.  See the NOTICE file distributed with
//  this work for additional information regarding copyright ownership.
//  The ASF licenses this file to You under the Apache License, Version 2.0
//  (the "License"); you may not use this file except in compliance with
//  the License.  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//

== Running the Hello-Webapp application

The `hello-webapp` web-application uses spring boot and is generally startable from the commandline.

It assumes you have connected an `Arduino` device running a StandardFirmata sketch and have connected an analog input to pin 1.
If you don't have an `Arduino` at hand, please see the next section on how to run this application without any hardware requirements.

By running the following command, the application should be available at http://localhost:8080 after starting.

  java -jar plc4j-hello-webapp-webapp-0.7.0-SNAPSHOT.war --plc4x.watertank.connection-string=firmata://cu.usbmodem144101

The `plc4x.watertank.connection-string` is required as with my device the path of the virtual com port changes every time I connect the device.
If you want to use it in a fixed scenario, please simply edit the `src/main/resources/application.properties` to your fixed value and rebuild the application.
After that you can use it without the additional argument.

If you happen to also have to change the address of your analog input, you can override the default of `analog:0` by providing or changing the `plc4x.watertank.address-string.waterlevel` setting the same way.

=== Running the Application without Hardware

If you just want to try out the Application without any hardware, you can start the application like this:

   java -jar plc4j-hello-webapp-webapp-0.7.0-SNAPSHOT.war --plc4x.watertank.simulation=true

This will use a random number generator that generates a new value every second.