Difference between revisions of "Auf- und Endladung eines Kondensators"
Jump to navigation
Jump to search
(Created page with "{{Infobox Experiment | Name = Auf- und Entladung eines Kondensators | Category = Arduino library experiments | Sensors = Owon OW18B }} Der DS18B20 ist ein sehr weit verbre...") |
|||
| Line 5: | Line 5: | ||
}} | }} | ||
| − | + | [[File:Kondensator_1.jpg]] | |
| − | |||
| − | [[File: | ||
==Aufbau== | ==Aufbau== | ||
| − | + | [[File:Kondensator_2.jpg]] | |
| − | |||
| − | |||
| − | |||
| − | [[File: | ||
Revision as of 12:21, 1 September 2023
Auf- und Entladung eines Kondensators
| Experiment | Auf- und Entladung eines Kondensators |
|---|---|
| Category | Arduino library experiments |
| Used sensors | Owon OW18B |
Aufbau
Programmierung
Der ESP32 wird über die Arduino IDE programmiert. Es müssen die Definitionen für den ESP32 und die phyphox-Bibliothek installiert sein. Siehe dazu das Video unter Category: Arduino library experiments.
Es ist darauf zu achten, dass jeder ESP32 eine eigene Kennung hat (diese wird in PhyphoxBLE::start("Thermometer_01") festgelegt). Anschließend kann über das Plus-Symbol in phyphox ein Bluetooth-Experiment hinzugefügt werden, das Experiment wird dann automatisch geladen.
#include <phyphoxBle.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
int dt = 500;
void setup(void)
{
PhyphoxBLE::start("Thermometer_01"); //Start the BLE server
//Experiment
PhyphoxBleExperiment experiment;
experiment.setTitle("Thermometer");
experiment.setCategory("Arduino Experiments");
experiment.setDescription("Plot the Temperature over time.");
//View
PhyphoxBleExperiment::View view;
//Graph
PhyphoxBleExperiment::Graph graph;
graph.setLabel("Temperatur");
graph.setUnitX("s");
graph.setUnitY("°C");
graph.setLabelX("time");
graph.setLabelY("Theta");
// graph.setChannel(1,2);
view.addElement(graph); //Attach graph to view
experiment.addView(view); //Attach view to experiment
PhyphoxBLE::addExperiment(experiment); //Attach experiment to server
sensors.begin();
}
void loop(void)
{
sensors.requestTemperatures();
float T = sensors.getTempCByIndex(0);
PhyphoxBLE::write(T);
delay(dt);
}

