What year car is this? Is it an 84 or 85? Is it (or was it) a manual tranny car?
The first pic is your barometric sensor. It is part of the circuit that adjusts the fuel mixture when the car is driven at higher altitudes.
Depending on the year of your car, the second pic may be part of the "upshift light" circuit.