Index \ Processing \ BasicX \ C

The Wiring environment is written in C/C++ and the Processing environment is written in Java so there are many similarities between these two languages. Large distinctions occur with arrays declaration, loops syntax and the printing command. Wiring is used to create programs that run in the Wiring hardware. Processing is used to create programs that run on a PC.


Wiring C
int x = 70; // Initialize
x = 30; // Change value
int x = 70; // Initialize
x = 30; // Change value
float x = 70.0;
x = 30.0;
float x = 70.0;
x = 30.0;
int[] a = {5, 10, 11}; // Create an array
a[0] = 12; // Reassign

int[] a = {5, 10, 11}; // Create an array
a[0] = 12; // Reassign

int a[8]; // Declare
a[0] = 1; // Initialize
int[] a = new int[8]; // Declare
a[0] = 1; // Initialize
int *a = new int[8]; // Declare
a[0] = 1; // Initialize

int[] a = new int[8]; // Declare
a[0] = 1; // Initialize

Wiring C

void setup() {
  // Statements
}

void loop() {
  // Statements
}

void setup() {
  // Statements
}

void draw() {
  // Statements
}

for(int a=45; a<=55; a++) {
// Statements
}
for(int a=45; a<=55; a++) {
// Statements
}
if(c==1) {
// Statements
}
if(c==1) {
// Statements
}
if(c!=1) {
// Statements
}
if(c!=1) {
// Statements
}
if(c < 1) {
// Statements
}
if(c < 1) {
// Statements
}
if(c >= 1) {
// Statements
}
if(c >= 1) {
// Statements
}
if((c >= 1) && (c < 20)) {
// Statements
}
if((c >= 1) && (c < 20)) {
// Statements
}

if(c >= 20) {
// Statements 1
} else if (c == 0) {
// Statements 2
} else {
// Statements 3
}

if(c >= 20) {
// Statements 1
} else if (c == 0) {
// Statements 2
} else {
// Statements 3
}
Wiring C

// Comment

// Comment
void doIt(int x) {
  // Statements
}

doIt(x);
void doIt(int x) {
  // Statements
}

doIt(x);
int square(int x)
{
  return x*x;
}

square(X);
int square(int x)
{
  return x*x;
}

square(X);
Wiring C

Serial.println("hello world");

println("hello world");
int a = 55;
Serial.print(a, DEC);
int a = 55;
print(a);
int a = 55;
Serial.print("a is ");
Serial.print(a, DEC);
int a = 55;
print("a is " + a);