The digitalWrite ( ) functions outputs a value on a pin. As an output, it can drive an actuator like an LED.
#Sketchup housebuilder modify script serial
When configured as an input, a pin can detect the state of a sensor like a pushbutton this is discussed in the Digital Read Serial tutorial. To use it, you pass it the number of the pin to configure and the constant INPUT or OUTPUT. The pinMode ( ) function configures a pin as either an input or an output. These parameters are used by the pinMode ( ) function to decide which pin and mode to set. For example, the line pinMode ( ledPin, OUTPUT ) calls the pinMode ( ) function, passing it two parameters: ledPin and OUTPUT. You can call a function that's already been defined (either in your sketch or as part of the Arduino language).
#Sketchup housebuilder modify script code
The code between the is called the body of the function: what the function does. The text before and after the name specify its return type and parameters: these will be explained later. In this example, we used the Line, Tape Measure, 2 Point Arc, and Push/Pull tool to change the top of the Picket component. Use the SketchUp drawing tools to edit your component.
![sketchup housebuilder modify script sketchup housebuilder modify script](https://www.design8.eu/images/sketchup/edu_overview_2021.jpg)
Or select it, context-click the selection, and choose Edit Component, or simply hit Enter. The first line provides information about the function, like its name, "setup". To open the context, you can double-click the component. For example, here's the definition of the setup ( ) function from the Blink example: FunctionsĪ function (otherwise known as a procedure or sub-routine) is a named piece of code that can be used from elsewhere in a sketch. There's more information in the Variables tutorial. For example, you could store the value read from an input into a variable. Often, however, the value of a variable will change while the sketch runs. The advantage of using a variable is that it's easier to move the LED to a different pin: you only need to edit the one line that assigns the initial value to the variable. In this case, the person writing the program could have chosen not to bother creating the ledPin variable and instead have simply written 13 everywhere they needed to specify a pin number. Every time the name ledPin appears in the code, its value will be retrieved.
![sketchup housebuilder modify script sketchup housebuilder modify script](https://docs.unrealengine.com/4.27/Images/WorkingWithContent/Importing/Datasmith/SoftwareInteropGuides/SketchUp/ExportingDatasmithContentfromSketchUp/sketchup_export_model.jpg)
It's being used to indicate which Arduino pin the LED is connected to. For example, the line from the Blink sketch above declares a variable with the name ledPin, the type int, and an initial value of 13.
![sketchup housebuilder modify script sketchup housebuilder modify script](https://i.ytimg.com/vi/AFq956BPrjI/maxresdefault.jpg)
VariablesĪ variable is a place for storing a piece of data. The message "LED connected to digital pin 13" is a comment. 1 int ledPin = 13 // LED connected to digital pin 13