Class VBBMicro
java.lang.Object
virtualbreadboard.vbbmicro.target.VBBMicro
- Direct Known Subclasses:
Arduino
VBBMicro is a programmable test probe for virtual breadboard circuits
The VBBMicro can be used to drive automated tests using familiar Arduino IO via pins or by querying and controlling VBB Component widgets.
The VBB Unit Test framework is supported when using the JUnit style assert()
and @Test and @Before bindings.
import virtualbreadboard.vbbmicro.target.VBBMicroUNO;
import virtualbreadboard.cdk.widget.ButtonWidget;
public class TestApp extends VBBMicroUNO{
@Before
void preTest(){
// Code executed before each test
}
@Test
void testOneThing(){
// Code executed before each test
assertTrue(false);//fail first!
}
@Test
void testAnotherThing(){
// Code executed before each test
assertTrue(false);//fail first!
}
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
analogRead
(int pin) void
analogWrite
(int pin, int value) void
assertTrue
(boolean value) Injects test result into the Unit Test framework.void
assertTrue
(String message, boolean value) void
delay
(int milliseconds) void
delay
(long milliseconds) static int
digitalRead
(int pin) Reads the value from a specified digital pin, either HIGH or LOW.void
digitalWrite
(int pin, boolean value) void
digitalWrite
(int pin, int value) Write a HIGH or a LOW value to a digital pin.getComponent
(String Id) Queries the Breadboard for the VBBComponent of the IdgetNamedNet
(String netName) Queries the Breadboard to bind a named net.void
loop()
Processing/Arduino 'loop' method.long
millis()
void
pinMode
(int pin, int mode) Configures the specified pin to behave either as an input or an output.void
setup()
Processing/Arduino 'setup' method.
-
Field Details
-
HIGH
public static final int HIGH- See Also:
-
LOW
public static final int LOW- See Also:
-
OUTPUT
public static final int OUTPUT- See Also:
-
ANALOG_OUTPUT
public static final int ANALOG_OUTPUT- See Also:
-
INPUT
public static final int INPUT- See Also:
-
INPUT_PULLUP
public static final int INPUT_PULLUP- See Also:
-
-
Constructor Details
-
VBBMicro
public VBBMicro()
-
-
Method Details
-
loop
public void loop()Processing/Arduino 'loop' method. Override to execute repeatedly. -
setup
public void setup()Processing/Arduino 'setup' method. Override to execute once on startup. -
delay
public void delay(long milliseconds) -
delay
public void delay(int milliseconds) -
pinMode
public void pinMode(int pin, int mode) Configures the specified pin to behave either as an input or an output.- Parameters:
pin
- the number of the pin whose mode you wish to setmode
- INPUT or OUTPUT
-
digitalWrite
public void digitalWrite(int pin, int value) Write a HIGH or a LOW value to a digital pin. If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the Vdd (Typically 5V or 3.3V ) for HIGH, 0V (ground) for LOW.- Parameters:
pin
- the pin number to write tovalue
- HIGH or LOW
-
digitalWrite
public void digitalWrite(int pin, boolean value) -
analogRead
public int analogRead(int pin) -
analogWrite
public void analogWrite(int pin, int value) -
digitalRead
public static int digitalRead(int pin) Reads the value from a specified digital pin, either HIGH or LOW.- Parameters:
The
- pin to read- Returns:
- HIGH or LOW
-
millis
public long millis() -
assertTrue
public void assertTrue(boolean value) Injects test result into the Unit Test framework.- Parameters:
value
- the result of a condition
-
assertTrue
-
getComponent
Queries the Breadboard for the VBBComponent of the Id -
getNamedNet
Queries the Breadboard to bind a named net.
-